# zoneadm –z halt <thezone>
# zoneadm –z detach <thezone>
# cd /export/zone/<thezone>
# find . -print -depth | cpio -o > /nas/.cpio
# zoneadm –z attach <thezone>
# zoneadm –z boot <thezone>
Author: rdircio
Add cdrom to yum as repo
Mount your cdrom,
create /etc/yum.repos.d/local.repo , with contents:
[local]
name=cdrom
baseurl=file:///mnt/cdrom
then just “yum search” and “yum install”
Get nic kernel module
if you want to know what kernel module your network interfaces use, you can use “getdriver.ksh”:
#!/bin/bash
ifconfig -a | egrep -i 'wlan|eth' | egrep -v 'vbox|mon'| awk '{ print $1 }'|while read i;do
echo -n "$i : "
readlink /sys/class/net/$i/device/driver| awk -F'/' '{ print $NF }'
done
the output is something like this:
root@kraftek:~# /scripts/getdriver
eth0 : atl1c
wlan0 : carl9170
wlan1 : brcmsmac
scan for SAN disks in solaris
cfgadm -al | grep -i fabric | awk '{ print $1 }' | xargs cfgadm -c configure
devfsadm -C
format < /dev/null | egrep -i 'emc|dgc|hit|netapp
'
Scan for disks in fiber channel adapters (hba,qlogic)
ls /sys/class/fc_host/ | while read h;do echo $h echo 1 > /sys/class/fc_host/$h/issue_lip echo "- - -" > /sys/class/scsi_host/$h/scan done
Oncall rotation bash script
We have a formula for shifts and a list of people, we need to fill a calendar with them.
These are the iterations for each week “formula.txt”, each row is a week, the first value is the iteration number, the other 4 values in the row are the number for a team member, these iterations are the sequence of combinations so that people are not oncall too frequently:
1 1 2 3 4
2 5 6 7 8
3 4 3 2 1
4 8 7 6 5
5 2 1 4 3
6 6 5 8 7
7 3 4 1 2
8 7 8 5 6
the numbers for the team members are in “roster.txt”:
1 FFlinstone XXJA01
2 Jdoe XXJD02
3 OOsbourne XXHR01
4 AHitchcock XXDD02
5 ARose XXAW04
6 EAPoe XXFP01
7 ACooper XXBC06
8 BJovi XXSL01
this is “oncall.ksh”
#!/bin/bash
start_date=20120604
end_date=20120902
formula_current_row=5
formula_rows=8
get_roster()
{
for p in `grep ^$1 formula.txt | awk ‘{ print $2″ “$3” “$4” “$5 }’`;do
echo -n “`grep ^$p roster.txt|awk ‘{ print $3″ ” }’`”
done
echo “”
}
get_weekend_roster()
{
for p in `grep ^$1 formula.txt | awk ‘{ print $2″ “$3” “$2” “$3 }’`;do
echo -n “`grep ^$p roster.txt|awk ‘{ print $3″ ” }’`”
done
echo “”
}
get_oncall()
{
tmpw=0
W=`date -d “$start_date $tmpw day” +”%W”`
for ((tmpw = 0; $(date -d “$start_date $tmpw day” +%s) <= $(date -d “$end_date” +%s); tmpw += 1))
do
P=$W
W=`date -d “$start_date $tmpw day” +”%W”`
if [ “$P” != “$W” ];then
let formula_current_row+=1
if [ $formula_current_row -gt $formula_rows ];then
formula_current_row=1
fi
fi
D=`date -d “$start_date $tmpw day” +”%Y-%m-%d %a%t”`
ISWEEKEND=`echo $D|egrep -i ‘sat|sun’|wc -l`
echo -n “$D ”
if [ $ISWEEKEND -gt 0 ];then
get_weekend_roster $formula_current_row
else
get_roster $formula_current_row
fi
done
}
generate_sql()
{
echo “use OnCall;”
get_oncall | while read l;do
ISWEEKEND=`echo $l|egrep -i ‘sat|sun’|wc -l`
if [ $ISWEEKEND -gt 0 ];then
echo $l | awk ‘{ print “insert into Detail (Date,Shift_C1_Pri,Shift_C1_Sec) values (“”$1″”,””$3″”,””$4″”) on DUPLICATE KEY UPDATE Shift_C1_Pri=””$3″”,Shift_C1_Sec=””$4″”;” }’
else
echo $l | awk ‘{ print “insert into Detail (Date,Shift_A1_Pri,Shift_A1_Sec,Shift_A2_Pri,Shift_A2_Sec) values (“”$1″”,””$3″”,””$4″”,””$5″”,””$6″”) on DUPLICATE KEY UPDATE Shift_A1_Pri=””$3″”,Shift_A1_Sec=””$4″”,Shift_A2_Pri=””$5″”,Shift_A2_Sec=””$6″”;” }’
fi
done
}
get_oncall
generate_sql > from_${start_date}_to_${end_date}.sql
TSM logs
Again another basic tivoli thing… in solaris TSM logs are at:
/var/tivoli
Using dlpiping to test an llt link on a veritas cluster
if an llt link shows down, you can always inject some traffic through the wire and see if you can catch it on the other side.
We first, on one side of the cluster find out the mac address of our interface, then start a “dlpiping server”
process on it.
# /opt/VRTSllt/getmac /dev/ce:0
/dev/ce:0 08:00:10:A7:1E:DC
# /opt/VRTSllt/dlpiping -s /dev/ce:0
Now, on the other side of the link, on the other server, we query for the mac address in the wire.
# /opt/VRTSllt/dlpiping -c /dev/ce:0 08:00:10:A7:1E:DC
08:00:10:A7:1E:DC is alive
if it says that the mac is alive then we have a good link.
linux multipath entries for EMC arrays
add this to your /etc/multipath.conf:
devices { ## Device attributes for EMC SYMMETRIX device { vendor "EMC " product "SYMMETRIX" path_grouping_policy multibus getuid_callout "/sbin/scsi_id -g -u -s /block/%n" path_selector "round-robin 0" features "0" hardware_handler "0" failback immediate } ## Device attributes for EMC CLARiiON device { vendor "DGC" product "*" path_grouping_policy group_by_prio getuid_callout "/sbin/scsi_id -g -u -s /block/%n" prio_callout "/sbin/mpath_prio_emc /dev/%n" hardware_handler "1 emc" features "1 queue_if_no_path" no_path_retry 300 path_checker emc_clariion failback immediate } }
ssh version
use:
ssh -V