This happens:
# ps -ef
oracle 31868 1 0 08:37 x y z 00:00:00 ora_p103_salerep
103 1789 1788 0 08:39 pts/2 00:00:00 -bash
103 2099 1789 0 08:39 pts/2 00:00:00 ps -ef
103 2100 1789 0 08:39 pts/2 00:00:00 grep -i 103
Notice we see “103″ in the first column instead of the username, this is because uid 103 is “siebadmin”, which
is >8 characters long. Ps has a column width of 8 on the first column, and if the username does not fit, it uses
the uid. This is not fixable, unless in source.
Adobe Central Output Server 5.5 (jetforms) remote usage
We had to install jetforms in an AIX machine, for development purposes, but didn’t have a license…
Figuring out it receives jobs and outputs pdfs in directories, well, we can just copy the jobs to a remote server
and retrieve the pdfs too.
The forms should also be placed somewhere to be replicated.
So we installed jetforms in a remote solaris machine, and wrote some daemon scripts in the AIX, to do the
job, form and result transfer.
The core of it all is /scripts/jf.ksh, a set of 3 daemons written in one script:
# cat /scripts/jf.ksh
#!/bin/ksh
echo “`date` starting…”
(while true;do
(for file in /usr/local/adobe/central/server/data/*.dat;do
echo “`date`: COPYING: $file TO REMOTE”
273/433
rcp $file wasdesa2:/usr/local/adobe/central/server/data
rm $file
done) >/dev/null 2>&1
sleep 4;
done ) &
(while true;do
(for file in `find /usr/local/adobe/central/server/etc/exprint/forms -type f -mtime -1`;do
echo “`date`: COPYING: $file TO REMOTE”
rcp $file wasdesa2:/usr/local/adobe/central/server/etc/exprint/forms
done) >/dev/null 2>&1
sleep 15;
done ) &
(while true;do
for file in `rsh wasdesa2 “find /usr/local/adobe/central/server/data -type f -mtime -100| grep -i pdf”`;do
if [ ! -f $file ];then
echo “`date`: COPYING: $file FROM REMOTE”
rcp wasdesa2:$file /usr/local/adobe/central/server/data
fi
done
sleep 4;
done ) &
The enclosed parentheses do the forking magic. We are using /.rhosts loose security for this, maybe we’ll use
keys on ssh later.
To keep the party going on and on, we wrote a “start” script
# cat /scripts/jetstart.ksh
#!/bin/ksh
P=`ps -ef | grep jf.ksh|grep -iv grep|wc -l`
if [ $P -eq 0 ];then
echo “jf is not running, starting..”
/scripts/jf.ksh > /scripts/jf.log &
echo “started”
fi
We also wrote a “stop” script:
# cat /scripts/jetstart.ksh
#!/bin/ksh
P=`ps -ef | grep jf.ksh|grep -iv grep|wc -l`
if [ $P -eq 0 ];then
echo “jf is not running, starting..”
/scripts/jf.ksh > /scripts/jf.log &
echo “started”
fi
And added a cron entry to keep it goin’
0,5,10,15,20,25,30,35,40,45,50,55
/scripts/jetstart.ksh > /dev/null 2>&1
Get asterisk music-on-hold live from an icecast+ices2 server
My asterisk version is 1.6.2.6
My freepbx version is 2.7.0.1
To get music-on-hold from a live source, i made a script (/scripts/streamx.ksh):
#!/bin/ksh
/usr/bin/ogg123 -q -b 128 -p 32 -d wav -f – http://kraftek.com:8000/stream.ogg| sox -t wav – -r 8000 -c 1 -t raw
– vol 0.10
27/433
and configured /etc/asterisk/musiconhold_additional.ksh with:
[default]
mode=custom
application=/scripts/streamx.ksh
And that is it!, just dial a conference room and you’ll get live music on hold while waiting for your friends to
join ![]()
Rephrase with a thesaurus
you will love it, it rephrases whatever you tell it ti
http://kraftek.com/cgi-bin/rephrase/index.sh
#!/bin/bash
echo “Content-type: text/html”
echo “”
echo “<html><body bgcolor=white><font size=-1>”
QUERY=`echo “$QUERY_STRING” | sed -n ‘s/^.*query=([^&]*).*$/1/p’ | sed “s/%20/ /g;s/ //g”`
QUERY=`echo $QUERY|sed ‘s/+/ /g’`
wget=/usr/bin/wget
thesaurize(){
l=`echo $1|wc -c`
if [ $l -le 5 ];then
echo $1
else
S=`$wget -nv -O – http://thesaurus.reference.com/search?q=”$1″ 2>&1|sed ‘s/>/>n/g;/^<script/,/</script>/d;/^<style/,/</style>/d;/^<form/,/</form>/d;s/<[^>]*>//g;s/,/,n/g’|sed -e ‘1,/Main Entry/d’ -e ‘/Antonyms/,$d;s/^[ t]*//;1,/Synonyms/d’ -e ‘/Antonyms/,$d’| sed ‘s/,//g’|egrep -v ‘^Part of Speech|^Main Entry|^Synonyms|^Antonyms|^Definition|*’|grep .|head -10|shuf -n 1`
SL=`echo $S|wc -c`
if [ $SL -gt 1 ];then
echo $S
else
echo $1
fi
fi
}
cat <<EOF
<style type=”text/css”>
form {
margin: 0px;
}
</style>
<form action=index.sh method=get>
Regurgitate: <input type=text size=80 name=query>
<input type=submit value=search>
</form><br><br>
EOF
echo “<b>Original:</b><br> $QUERY<br><br>”
echo “<b>Re-interpreted:</b><br>”
for i in 1 2 3 4 5;do
for word in $QUERY;do
echo -n “`thesaurize $word` “
done
echo “<br>”
done
echo “</body></html>”
create big concat on svm
#!/bin/ksh
( N=`format < /dev/null | egrep -i 'emc|hit' | wc -l| sed 's/ //g'`
/usr/ucb/echo -n "metainit d1 $N "
format < /dev/null | egrep -i 'emc|hit' | awk '{ print $2 }' | while read d;do
/usr/ucb/echo -n "1 ${d}s2 "
done
echo "" ) > /tmp/makevol.ksh
chmod 755 /tmp/makevol.ksh
mount using sshfs
Mounting example
$ sshfs -p 32 kraftek.com:/u01 /u01
To unmount it
$ fusermount -u /u01
check if async io is enabled
# cat /proc/sys/fs/aio-nr;cat /proc/sys/fs/aio-max-nr
110456
1048576
Get WWN tree info for an hba
To get all the wwns attached to an hba you can use this
# cfgadm -al -o show_FCP_dev | egrep ‘disk|tape’
create user’s homes from the entries at /etc/passwd
i don’t like to do a # cat /etc/passwd and manually create the users and chown their dirs… So, this is a one liner:
# grep -i home /etc/passwd | awk -F: ‘{print “mkdir ” $6 ” ; chown ” $1 ” ” $6 }’ > somefile; chmod 755 somefile;./somefile 183/433
scan for new disks inside a linux vmware vm
Just do this:
ls /sys/class/scsi_host/ | while read h;do echo "- - -" > /sys/class/scsi_host/$h/scan;done