3 ########## locad local defs
4 local_defs=~/LocalTestResources.helpers
5 if [ -f $local_defs ] ; then
8 echo "you should define qemuboxes and plcboxes in $local_defs"
12 if [ -z "$qemuboxes" -o -z "$plcboxes" ] ; then
13 echo "you should define qemuboxes and plcboxes in $local_defs"
17 ########## list: from trackers, what should be
18 alias list_qemus="head -v ~/tracker-qemus"
19 alias list_plcs="head -v ~/tracker-plcs"
20 alias list_all="list_qemus ; list_plcs"
22 ########## probe: from real data
23 alias probe_qemus='for box in $qemuboxes ; do echo qemu instances in $box ; ssh root@$box pgrep qemu ; done'
24 alias probe_plcs='for box in $plcboxes ; do echo plc instances in $box; ssh $box vserver-stat; done'
25 alias probe_all="probe_qemus ; probe_plcs"
27 ########## cleanup: stop plc or kill qemus
28 function cleanup_qemus () {
29 for box in $qemuboxes ; do
30 echo killing qemu instances in $box
31 ssh root@$box pkill qemu
33 if [ -f ~/tracker-qemus ] ; then
34 echo ~/cleaning tracker-qemus ; rm ~/tracker-qemus
37 function cleanup_plcs () {
38 for box in $plcboxes ; do
39 echo stopping vserver instances in $box
40 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'
42 if [ -f ~/tracker-plcs ] ; then
43 echo ~/cleaning tracker-plcs
47 alias cleanup_all="cleanup_qemus ; cleanup_plcs"
49 ########## reboot: reboot the root contexts
50 alias reboot_qemus='for box in $qemuboxes; do echo rebooting $box ; ssh root@$box shutdown -r now ; done'
51 alias reboot_plcs='for box in $plcboxes; do echo rebooting $box ; ssh root@$box shutdown -r now ; done'
52 alias reboot_all="reboot_qemus ; reboot_plcs"