3 ########## locad local defs
4 local_defs=~/LocalTestResources.helpers
5 if [ -f $local_defs ] ; then
8 echo "WARNING !! you should define qemuboxes and plcboxes in $local_defs"
11 if [ -z "$qemuboxes" -o -z "$plcboxes" ] ; then
12 echo "WARNING !! you should define qemuboxes and plcboxes in $local_defs"
15 ########## list: from trackers, what should be
16 alias list_qemus="head -v ~/tracker-qemus"
17 alias list_plcs="head -v ~/tracker-plcs"
18 alias list_all="list_qemus ; list_plcs"
20 ########## probe: from real data
21 alias probe_qemus='for box in $qemuboxes ; do echo qemu instances in $box ; ssh root@$box pgrep qemu ; done'
22 alias probe_plcs='for box in $plcboxes ; do echo plc instances in $box; ssh $box vserver-stat; done'
23 alias probe_all="probe_qemus ; probe_plcs"
25 ########## cleanup: stop plc or kill qemus
26 function cleanup_qemus () {
27 for box in $qemuboxes ; do
28 echo killing qemu instances in $box
29 ssh root@$box pkill qemu
31 if [ -f ~/tracker-qemus ] ; then
32 echo ~/cleaning tracker-qemus ; rm ~/tracker-qemus
35 function cleanup_plcs () {
36 for box in $plcboxes ; do
37 echo stopping vserver instances in $box
38 ssh root@$box 'cd /vservers ; for vsname in *; do echo -n "stop $vsname y/[n] ? "; read answer ; case $answer in nN) echo skipping $vsname ;; *) vserver $vsname stop ;; esac; done'
40 if [ -f ~/tracker-plcs ] ; then
41 echo ~/cleaning tracker-plcs
45 alias cleanup_all="cleanup_qemus ; cleanup_plcs"
47 ########## reboot: reboot the root contexts
48 alias reboot_qemus='for box in $qemuboxes; do echo rebooting $box ; ssh root@$box shutdown -r now ; done'
49 alias reboot_plcs='for box in $plcboxes; do echo rebooting $box ; ssh root@$box shutdown -r now ; done'
50 alias reboot_all="reboot_qemus ; reboot_plcs"