To get all the wwns attached to an hba you can use this
# cfgadm -al -o show_FCP_dev | egrep ‘disk|tape’
Uncategorized
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
Print extended info about your rpms
Use the queryformat modifier to print more info about your rpm
# rpm -qa –queryformat %-{name}-%{version}-%{release}-%{arch}”n”
You can grep for something there, because it is a full listing
Thanks to Fergus O’hea
“swapon -s” shows swap spaces as “(deleted)” if these are lvm volumes
[root@mylinux]# swapon -s
Filename Type Size Used Priority
/dev/systemvg/swapvol (deleted) partition 4095992 0 -3
According to http://kbase. redhat.com/faq/FAQ_79_4331.shtm we need to
add “swapoff -a && swapon -a” to the end of /etc/rc.d/rc. sysinit
We can also run
#swapoff -a && swapon -a
To fix it live, and we’ll see:
[root@mylinux]# swapon -s
Filename Type Size Used Priority
/dev/systemvg/swapvol partition 4095992 0 -3
114/433
changing a label from EFI to SMI
If your slice 2 is empty and you got partitions 0-9 in your disk when checkign it in “format”, you have an EFI label.
If you want to change it to a SMI label, you need to use “format -e” and when prompted for the label type,
choose SMI
partition> label
[0] SMI Label
[1] EFI Label
Specify Label type[1]: 0
Warning: This disk has an EFI label. Changing to SMI label will erase all
current partitions.
Continue? y
Auto configuration via format.dat[no]?
Auto configuration via generic SCSI-2[no]?
partition>
68/433
Quick and dirty script to query NIC speed
I already have a script like this in "miniexplorer", but it generates html and that may be overkill, so this is a quickie one to
query all network card ports in your solaris server about NIC speed.
#!/bin/ksh
ifconfig -a | grep flags | grep -v 'lo' |awk -F: '{ print $1 }' |uniq|while read IF;do
D=`echo $IF| sed s/[0-9,:]*$//`
IN=`echo $IF| sed 's/^[a-z]*//'`
echo "$D $IN -------------------------------------------------"
ndd -set /dev/$D instance $IN
(ndd -get /dev/$D ?|awk '$1!~/^?/{print$1}'|while read p;do
/usr/ucb/echo -n $p:;ndd -get /dev/$D $p;
done
kstat ${D}:${IN}) | egrep 'adv|link|speed' |sed 's/ //g'
done
vlc http streaming from a TV card
I got a TV card, it appears like this in lspci:
01:08.0 Multimedia controller: Philips Semiconductors SAA7131/SAA7133/SAA7135 Video Broadcast
Decoder (rev d1)
In order to stream 3 simultaneous streams, very low, low and high quality, you can do this:
#!/bin/ksh
#
/sbin/modprobe saa7134-alsa
sleep 2
DEV=/dev/tvcard
ps -ef | grep -i vlc | grep -v grep |grep -i $DEV | awk '{ print $2 }'| while read P;do
kill -9 $P
done
VBR=96
ABR=24
W=320
H=240
### --deinterlace-mode {discard,blend,mean,bob,linear} : deinterlacing mode (default: discard)
# width=320,height=240 qpmax=40 x264{crf=5,profile=extended,level=1.0}
# :standard{access=http{user=video,pwd=cable},mux=asf,dst=0.0.0.0:8088}
#
venc=x264{level=2,nr=1000,me=tesa,b-pyramid,bitrate=64,ref=4,b-adapt=2,bframes=2,partitions=all, keyint=2500}
VLC="/usr/local/bin/cvlc --logo-file /disk2/logox.png v4l2://$DEV :input=2 :standard=8 :input-slave=alsa://hw:1
,0 --alsa-samplerate=32000 --deinterlace-mode linear --sout "
35/433
VERYLOW="transcode{vcodec=h264,acodec=mp4a,channels=1,width=160, height=120,vb=24,ab=16,venc=x264{bframes=0,leve
l=5,nr=1000,b-pyramid,b-adapt=2, hurry-up},audio-sync,sfilter=logo}:standard{access=http,dst=0.0.0.0:8011/stream
.flv}"
LOW="transcode{vcodec=h264,acodec=mp4a,channels=1,width=${W},height=${H},vb=${VBR},ab=${ABR},venc=x264{bframes=
0,level=5,nr=1000,b-pyramid,b-adapt=2},audio-sync,sfilter=logo}: standard{access=http,dst=0.0.0.0:8012/stream.fl
v}"
36/433
HIGH="transcode{vcodec=h264,acodec=mp4a,channels=2,ab=128,venc=x 264{bframes=0,level=5,nr=1000,b-pyramid,b-adapt
=2,hurry-up},deinterlace,audio-sync,sfilter=logo}:standard{access=http,dst=0.0.0.0:8013/stream.flv}"
/usr/local/bin/v4l2-ctl -d $DEV --set-tuner=stereo
/usr/local/bin/v4l2-ctl -d $DEV --set-standard=0
/usr/local/bin/ivtv-tune -d $DEV -t us-cable -c3
#--- audio codecs can be mpga or mp3 or m4a
#--- mux can be ogg,ts,mp4,asf,ps,mpeg1,asfh, mpjpeg
#--- low quality
#$VLC "#$VERYLOW"
#--- low quality
#$VLC "#$LOW"
#--- LAN quality
#$VLC "#$HIGH"
#---- single command, high quality AND low quality using h264_vdpau and x264 as encoder
$VLC "#duplicate{dst="$VERYLOW",dst="$LOW",dst="$HIGH"}"
#$VLC "#duplicate{dst="$VERYLOW",dst="$HIGH"}"
#$VLC "#duplicate{dst="$LOW",dst="$HIGH"}"
#$VLC "#duplicate{dst="$VERYLOW",dst="$LOW"}"
"#duplicate" is used in order to have 2 streams working simultaneously from the same input device, for each
output srteam we use a "dst="
random wallpaper in gnome
Say you want a random Gnome wallpaper from google each 60 seconds, but if your machine is not connected, just take
the backdrop from a local directory ~/Desktop/backdrops. you can put up a couple of scripts to do this, the main one
would be /scripts/changewall.ksh
#!/bin/bash
mkdir -p /tmp/wallpapers
E=`ps -ef | grep -i changewall | grep -i $USER | grep -iv grep | wc -l`
if [ $E -gt 2 ];then
echo “wallpaper changer already running for $USER”
exit 1
fi
i=120
while true;do
i=`cat /scripts/time.txt`
rm -fR /tmp/wallpapers/*
RANGE=10
number=$RANDOM
let “number %= $RANGE”
number=$(($number))
ping -w 10 -c 2 www.google.com > /dev/null 2>&1
R=$?
if [ $R -eq 0 ] && [ $number -lt 9 ];then
/scripts/wallpaper.ksh > /dev/null 2>&1
F=`ls /tmp/wallpapers`
N=`echo $F | wc -c`
if [ $N -gt 1 ];then
gconftool-2 -t string -s /desktop/gnome/background/picture_filename “/tmp/wallpapers/$F”
# cp “/tmp/wallpapers/$F” $HOME/Desktop/backdrops/
else
cd $HOME/Desktop/backdrops
ls -1 *.jpg | head -n`expr $RANDOM % `ls -1 *.jpg | wc -l“ | tail -n1 | echo `pwd`/`xargs` | gconftool-2 -t string -s /desktop/gnome/background/picture_filename “`xargs`”
fi
else
cd $HOME/Desktop/backdrops
ls -1 *.jpg | head -n`expr $RANDOM % `ls -1 *.jpg | wc -l“ | tail -n1 | echo `pwd`/`xargs` | gconftool-2 -t string -s /desktop/gnome/background/picture_filename “`xargs`”
fi
sleep $i
done
Then you would need the support script, to get images from google according to a random word that comes
from /scripts/wallpaper-subjects.txt program: /scripts/wallpaper.ksh
#!/bin/ksh
cat /scripts/wallpaper-subjects.txt | head -n`expr $RANDOM % `cat /scripts/wallpaper-subjects.txt | wc -l“ | tail -n1 > /tmp/subject
QUERY=`cat /tmp/subject | sed ‘s/ /%20/g’`
RANGE=10
number=$RANDOM
let “number %= $RANGE”
number=$(($number + 1))
IMG=`curl -m 10 -A “Mozilla/3.0 (compatible; AvantGo 3.2)” “http://images.google.com/images?as_q=${QUERY}&as_filetype=jpg&biw=1680&bih=1024&safe=active&as_st=y&tbs=isch:1,itp:photo,islt:2mp,isz:l,ift:jpg” 2>/dev/null |sed -e ‘s/>/>n/g’ | awk ‘{s=substr($0,index($0,”http”),index($0,”jpg”));print substr(s,1,index(s,”.jpg”)+3)}’ | grep jpg |egrep -v ‘starkeith|gstatic|scaredmonkeys|tripod|flickr’|sed ‘s/2520/20/g’ | head -$number | tail -1`
mkdir -p /tmp/wallpapers
cd /tmp/wallpapers
wget –timeout=10 $IMG
you can add /scripts/changewall.ksh to your autostart stuff in gnome, going to system –> preferences –>
startup applications
ENJOY!
configure up2date on RHEL AS 2.1
If you don’t like graphics…
go to /etc/sysconfig/rhn
and edit “up2date” and “rhn_register”
… and a happy new year
212/433