define PLC_MAIL_FROM_ADDRESS
[tests.git] / system / helpers.aliases
1 ## -*-sh-*-
2
3 ########## locad local defs
4 local_defs=~/LocalTestResources.helpers
5 if [ -f $local_defs ] ; then 
6     source $local_defs
7 else
8     echo "WARNING !! you should define qemuboxes and plcboxes in $local_defs"
9 fi
10
11 if [ -z "$qemuboxes" -o -z "$plcboxes" ] ; then
12     echo "WARNING !! you should define qemuboxes and plcboxes in $local_defs"
13 fi
14
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"
19
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"
24
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
30     done
31     if [ -f ~/tracker-qemus ] ; then 
32         echo ~/cleaning tracker-qemus ; rm ~/tracker-qemus 
33     fi
34 }
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'
39     done
40     if [ -f ~/tracker-plcs ] ; then 
41         echo ~/cleaning tracker-plcs
42         rm ~/tracker-plcs
43     fi
44 }
45 alias cleanup_all="cleanup_qemus ; cleanup_plcs"
46
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"
51