#!/bin/bash for z in `zoneadm list -cv | grep -iv global | grep -v NAME|awk '{ print $2 }'` ;do zonecfg -z $z info | grep -i vx | grep -i rdsk | awk -F'/' '{ print $5 }' | sort | uniq | while read dg;do # echo "----------------- $z : $dg" dgs=$dg vxdisk -o alldgs list | egrep "$dgs"| awk '{ print $1 " " $4 }' | while read -r d g;do D=`/usr/sbin/vxdisk list $d | egrep '^c.t.*' | awk '{ print $1 }'` NOS2=`echo $D | sed 's/s2$//g'` SIZE=`grep -i $NOS2 format.txt | awk '{ print $NF }' | awk -F'-' '{ print $NF }' | sed 's/>//g;s/GB//g'` echo "$z : $g : $NOS2 : $SIZE : $d" done done done
Uncategorized
get disk serial ids in AIX
#!/bin/sh
lspv | awk '{ print $1 }' | while read d;do
S=`lsmpio -ql $d | grep -i serial | awk '{ print $3 }'`
echo "$d : $S"
done
Create a pacemaker resource from a systemd service
pcs resource create example systemd:custom.service --group mygroup
Create an azure-lb resoruce in a pacemaker cluster
pcs resource create nc_sid_ASCS azure-lb port=62001 --group sid_ascs01_group
Change a parameter in a pacemaker resoruce
For a NFS filesystem, if we want to change the NFS server ip:
pcs resource update my_fs_resource device=192.168.1.8:/SID_cluster/usr/sap/SID/AAS02
For an IPaddr2 resource, to change the ip address:
pcs resource update SID_vip_aas ip=192.168.1.18
change order of resource inside pacemaker resource group
pcs resource group add my_resource_group my_resource_to_move --before another_resource
add ip blocklist to ufw
reconfigure db2 pacemaker cluster with different ip and ethernet dev
[root@clusternode1 ~]# crm configure edit db2_clusternode1_ens33
[root@clusternode1 ~]# crm configure edit db2_uclusternode2_ens33
[root@clusternode1 ~]# crm configure edit db2_db2bwt_db2bwt_BWT-primary-VIP
enable timestamps in history
echo 'export HISTTIMEFORMAT="%F %T "' >> /etc/bashrc
copy permissions and owners from another unix
this script will generate 2 scripts “chown_cmds.bash” and “chmod_cmds.bash” from a find -ls output, those 2 scripts can be used to set permissions and ownership to files copied to another server
!/bin/sh
>/root/chown_cmds.bash
>/root/chmod_cmds.bash
echo "set -x " >> /root/chown_cmds.bash
echo "set -x" >> /root/chmod_cmds.bash
find /interfacestst -ls | grep -i '/' > /tmp/lsf
cat /tmp/lsf | awk '{ print "chown "$5":"$6" \""$NF "\"" }' > /root/chown_cmds.bash
(
cat /tmp/lsf | while read l;do
perms=echo $l | awk '{ print $3 }'
f=echo $l | awk '{ print $NF }'
OWNER=$(echo $perms | sed -e "s/.(…)./\1/" | sed -e "s/[-]//g" ) GROUP=$(echo $perms | sed -e "s/….(…)./\1/" | sed -e "s/[-]//g" )
OTHER=$(echo $perms | sed -e "s/…….(…).*/\1/" | sed -e "s/[-]//g" )
echo "chmod u=${OWNER},g=${GROUP},o=${OTHER} ${f}"
done
) |tee /root/chmod_cmds.bash