Last change
on this file was
219,
checked in by rock, 14 years ago
|
Add: KVM PXE VM deployment
|
-
Property svn:executable set to
*
|
File size:
1.1 KB
|
Rev | Line | |
---|
[206] | 1 | #!/bin/bash |
---|
| 2 | # Program: |
---|
| 3 | # Check DRBL total vm status |
---|
| 4 | # Author: |
---|
| 5 | # Jazz, Rock {jazz, rock}@nchc.org.tw |
---|
| 6 | # Version: |
---|
| 7 | # 1.0 |
---|
| 8 | # History: |
---|
| 9 | # 2010/09/09 Rock First release (1.0) |
---|
| 10 | |
---|
| 11 | source /opt/drbl-virt/conf/drbl-virt.conf |
---|
| 12 | source $Work_Path/functions_drbl_virt |
---|
| 13 | |
---|
| 14 | |
---|
| 15 | # [Varliables] |
---|
| 16 | vm_total_status_file=/tmp/vm_totoal_status.$$ |
---|
[208] | 17 | vm_IP_files=$(ls $Work_Home/etc/IP_VM_eth[0-9]) |
---|
[206] | 18 | |
---|
| 19 | # [Main] |
---|
| 20 | check_root |
---|
| 21 | |
---|
| 22 | echo -e "VM_IP VM_Hostname \t VM_Status" >> $vm_total_status_file |
---|
| 23 | echo "------------------------------------------------------" >> $vm_total_status_file |
---|
| 24 | |
---|
| 25 | for vm_IP_file in $vm_IP_files |
---|
| 26 | do |
---|
| 27 | # local variables |
---|
| 28 | vm_IPs=$(cat $vm_IP_file | awk '{print $1}') |
---|
| 29 | |
---|
| 30 | for vm_IP in $vm_IPs |
---|
| 31 | do |
---|
| 32 | # check network status |
---|
[219] | 33 | IP_status="online" |
---|
[206] | 34 | ping -c1 -w1 $vm_IP > /dev/null 2>&1 || IP_status="offline" |
---|
| 35 | vm_IP_Hostname=$(sed -n "/$vm_IP/p" $vm_IP_file) |
---|
| 36 | echo -e "$vm_IP_Hostname \t\t $IP_status" >> $vm_total_status_file |
---|
| 37 | done |
---|
| 38 | |
---|
| 39 | done |
---|
| 40 | |
---|
| 41 | cat $vm_total_status_file |
---|
| 42 | |
---|
| 43 | # dlete tmp file |
---|
| 44 | rm -f $vm_total_status_file |
---|
Note: See
TracBrowser
for help on using the repository browser.