Setting the max number of file descriptors open limit

To check kernel set open files limit
% cat /proc/sys/fs/file-max
8192
To increase kernel set to 65535 (as root)
# echo “65535” > /proc/sys/fs/file-max
If you want this new value to survive across reboots add it to /etc/sysctl.conf
fs.file-max = 65535
You can load these values live from the sysctl.conf file.
# sysctl -p /etc/sysctl.conf
The previous settings will only be for root, we need to adjust some files for all
the users to have them inherited.
To increase this to 65535 for all users (as root)
add two lines to /etc/security/limits.conf
kraftek.html POSTS rescue rescued.html rescued.txt x y z soft nofile 65535
kraftek.html POSTS rescue rescued.html rescued.txt x y z hard nofile 65535
Now add the next entry to /etc/pam.d/login
session required /lib/security/pam_limits.so
Relogin as your non-root user and check the new file open limit with:
$ ulimit -n
154/433

multipathing in oracle enterprise linux 5

# cp /usr/share/doc/device-mapper-multipath-0.4.7/multipath.conf.annotated /etc/multipath.conf
# chkconfig –add multipathd
# chkconfig multipathd on
# reboot
For each lun assigned to you a device under /device/mapper will apear, do a fdisk to each one:
# fdisk /dev/mapper/360060e80047656000000765600000e43
# fdisk /dev/mapper/360060e80047656000000765600000e44
# fdisk /dev/mapper/360060e80047656000000765600000e45
# fdisk /dev/mapper/360060e80047656000000765600000e46
# fdisk /dev/mapper/360060e80047656000000765600000e47
# fdisk /dev/mapper/360060e80047656000000765600000e48
# fdisk /dev/mapper/360060e80047656000000765600000e49
In each case do a “p” and then a “w” to overwrite the volume label, you will have to restart the server.
# reboot
Once back, open the lvm assistant:
# /usr/bin/system-config-lvm
once there initialize each block device found at:
# ls /dev/dm*
after that you can create a volume group and volumes 🙂
188/433

Vmware tools won’t compile on suse 9.2

You basically get “/bin/sh: scripts/basic/fixdep: No such file or directory”
Using 2.6.x kernel build system.
make: Entering directory `/tmp/vmware-config9/vmmon-only’
make -C /usr/src/linux/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. modules
make[1]: Entering directory `/usr/src/linux-2.6.5-7.314′
Makefile:465: .config: No such file or directory
CC [M] /tmp/vmware-config9/vmmon-only/linux/driver.o
/bin/sh: scripts/basic/fixdep: No such file or directory
make[2]: kraftek.html POSTS rescue rescued.html rescued.txt x y z [/tmp/vmware-config9/vmmon-only/linux/driver.o] Error 1
make[1]: kraftek.html POSTS rescue rescued.html rescued.txt x y z [module/tmp/vmware-config9/vmmon-only] Error 2
make[1]: Leaving directory `/usr/src/linux-2.6.5-7.314′
make: kraftek.html POSTS rescue rescued.html rescued.txt x y z [vmmon.ko] Error 2
make: Leaving directory `/tmp/vmware-config9/vmmon-only’
Unable to build the vmmon module.
If you don’t have a .config file in your kernel source you can:
# make cloneconfig
Then it might complain that
“scripts/modpost: No such file or directory”
So you just copy it according to the kernel you’re running:
89/433
# uname -a
Linux imdalapp300b 2.6.5-7.314-smp #1 SMP Mon Sep 15 16:43:00 UTC 2008 i686 athlon i386 GNU/Linux
# cp /usr/src/linux-2.6.5-7.314-obj/i 386/smp/scripts/modpost /usr/src/linux-2.6.5-7.314
Now you can run again “vmware-config-tools.pl”
90/433

Call progress for dahdi calls in asterisk-java

I wanted to generate a call from a script, and deliver a voice message, through a DAHDI channel, to a pots line.
This class does it, it tells you in the end if the line was busy, if it was never answered or if the call succeeded.
This is, if you trust dahdi callprogress, which is really broken… this example works better for SIP calls.
import org.asteriskjava.live.AsteriskChannel;
import org.asteriskjava.live.DefaultAsteriskServer;
import org.asteriskjava.live.LiveException;
import org.asteriskjava.live.ManagerCommunicationExcept ion;
import org.asteriskjava.live.OriginateCallback;
import org.asteriskjava.manager.action. OriginateAction;
import org.asteriskjava.util.Log;
import org.asteriskjava.util.LogFactory;
public class AsteriskCall implements OriginateCallback {
private final Log logger = LogFactory.getLog(getClass());
private DefaultAsteriskServer asteriskServer = null;
private String strChannelStatus = “NoStatusYet”;
private String number=””;
private String message=””;
public AsteriskCall() {
this.asteriskServer = new DefaultAsteriskServer(“somewhere.org”,”admin”,”mypass”);
}
public OriginateAction setupOriginate(String number,String message) {
OriginateAction originateAction = new OriginateAction();
originateAction. setChannel(“DAHDI/1/”+number);
originateAction. setApplication(“Playback”);
originateAction. setData(message) ;
originateAction. setActionId(number);
originateAction. setAsync(Boolean.TRUE);
originateAction. setTimeout(new Integer(30000));
return originateAction;
}
public void originate() {
OriginateAction originateAction = this.setupOriginate(number,message);
// System.out.println(“————— Calling: “+originateAction.getChannel()+”, Sending:
“+originateAction.getData());
try {
this.asteriskServer.originateAsync(originateAction, this);
}
catch (ManagerCommunicationException e) {
logger.error(“ManagerCommunicationException”);
}
15/433
Boolean out=false;
String previousStatus=””;
while(!out) {
if
(this.strChannelStatus.equals(“Busy”)||this.strChannelStatus.equals(“Success”)||this.strChannelStatus.equals(“No
Answer”)||this.strChannelStatus. equals(“Failed”) ) {
out=true;
}
try {
String currentStatus=this.strChannelStatus;
if (!currentStatus.equals(previousStatus)){
logger.info(“Current Channel State: “+currentStatus) ;
previousStatus=currentStatus;
}
Thread.sleep(1000);
}
catch (InterruptedException e) {
logger.info(“Interrupted.”);
}
}
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
logger.info(“Final Verdict: “+this.strChannelStatus);
}
@Override
public void onBusy(AsteriskChannel channel) {
this.strChannelStatus = “Busy”;
}
@Override
public void onDialing(AsteriskChannel channel) {
this.strChannelStatus = “Dialing”;
}
@Override
public void onFailure(LiveException cause) {
this.strChannelStatus = “Failed”;
}
@Override
public void onNoAnswer(AsteriskChannel channel) {
this.strChannelStatus = “No Answer”;
}
@Override
public void onSuccess(AsteriskChannel channel) {
this.strChannelStatus = “Success”;
}
public void setNumber(String n){
16/433
number=n;
}
public void setMessage(String m){
message=m;
}
public static void main(String[] args) throws Exception {
if (args.length<2){
System.out.println(“Usage: Call <number> <message>”);
System.exit(1);
}
AsteriskCall call = new AsteriskCall();
call.setNumber(args[0]);
call.setMessage(args[1]);
call.originate() ;
}
}
17/433

What to do when hpacucli is locked but there is no process for it

# hpacucli
HP
Array Configuration Utility CLI 7.50.18.0
Detecting Controllers…
Error:
Another instance of ACU is already running (possibly a service). Please
terminate the ACU application before running the ACU
CLI.
# ps -ef | grep -i
acu
root 26127 11377 0 15:12 pts/3 00:00:00 grep -i
acu
go to /opt/compaq/cpqacuxe/bld/locks and remove all the files in that directory, then run hpacucli
Thanks to Justin Lim
83/433

Physical PCI card position in sunfire E12k/E15k/E20k/E25k

if you need to know where, for instance is “qfe0” in your e25k, so someone can connect a cable there… you can use sun
doc #202571, which i have transformed to a script called “pos.ksh”:
#!/bin/ksh
echo “Expander Slot Device”
grep pci /etc/path_to_inst |while read nic;do
A=`echo $nic | awk -F”@” ‘{ print $2 }’ | awk -F”,” ‘{print $1}’`
O=`echo $nic | awk -F”,” ‘{print $2}’| awk -F”/” ‘{ print $1 }’`
T1=`grep ” $A” t1.txt`
E=`echo $T1 | awk ‘{ print $2 }’`
C=`echo $T1 | awk ‘{ print $1 }’`
S=`grep “^$C…$O” t2.txt | awk ‘{ print $2 }’`
echo “$E $S $nic”
done
You will need t1.txt:
IOC Expander AgentID
0 0 1c(28)
1 0 1d(29)
0 1 3c(60)
1 1 3d(61)
0 2 5c(92)
1 2 5d(93)
0 3 7c(124)
1 3 7d(125)
0 4 9c(156)
1 4 9d(157)
0 5 bc(188)
1 5 bd(189)
0 6 dc(220)
1 6 dd(221)
0 7 fc(252)
1 7 fd(253)
0 8 11c(284)
1 8 11d(285)
0 9 13c(316)
1 9 13d(317)
0 10 15c(348)
1 10 15d(349)
0 11 17c(380)
1 11 17d(381)
0 12 19c(412)
1 12 19d(413)
0 13 1bc(444)
117/433
1 13 1bd(445)
0 14 1dc(476)
1 14 1dd(477)
0 15 1fc(508)
1 15 1fd(509)
0 16 21c(540)
1 16 21d(541)
0 17 23c(572)
1 17 23d(573)
and t2.txt
IOC Slot Offset
0 0 600000
0 1 700000
1 2 600000
1 3 700000
So basically, inside any given domain you can do:
#./pos.ksh > slotmap.txt
then, if you want to know where your Quad Fast Ethernet “qfe” cards are, you can do:
bash-2.03# egrep “qfe|Expander” slotmap.txt
Expander Slot Device
2 3 “/pci@5d,700000/pci@1/SUNW,qfe@0,1” 0 “qfe”
2 3 “/pci@5d,700000/pci@1/SUNW,qfe@1,1” 1 “qfe”
2 3 “/pci@5d,700000/pci@1/SUNW,qfe@2,1” 2 “qfe”
2 3 “/pci@5d,700000/pci@1/SUNW,qfe@3,1” 3 “qfe”
17 3 “/pci@23d,700000/pci@1/SUNW,qfe@0,1” 4 “qfe”
17 3 “/pci@23d,700000/pci@1/SUNW,qfe@1,1” 5 “qfe”
17 3 “/pci@23d,700000/pci@1/SUNW,qfe@2,1” 6 “qfe”
17 3 “/pci@23d,700000/pci@1/SUNW,qfe@3,1” 7 “qfe”
And you’ll find out you have 2 quads, one is at IOBoard 2 slot 3, the other is at IOBoard 17 slot 3
A typical IOBoard has 4 slots, numbered from 0-3,
|—–|—–|
| | |
| slot|slot |
| 3 | 1 |
| | |
| | |
|—–|—–|
| | |
| | |
| slot|slot |
| 2 | 0 |
| | |
|—–|—–|
118/433
So Both cards are at the upper left, one on IOBoard 2 the other on IOBoard 17
Qfe0 is at IOBoard 2 slot 3
119/433