checkvm via ssh and local
This commit is contained in:
parent
c35b6d927a
commit
03499dd17c
8
nlvmi
8
nlvmi
|
@ -199,7 +199,15 @@ function stopall {
|
||||||
#check if VM is running
|
#check if VM is running
|
||||||
function checkvm {
|
function checkvm {
|
||||||
if [ -z $1 ]; then echo "checkvm needs one argument!"; exit 1; fi
|
if [ -z $1 ]; then echo "checkvm needs one argument!"; exit 1; fi
|
||||||
|
sqlite3 $SQLITEFILE "SELECT connectstring from vms LEFT JOIN servers ON vms.server = servers.hostname WHERE vmname='$1'" | while read line; do
|
||||||
|
CONN=$line
|
||||||
|
if [ ! -z $CONN ]; then
|
||||||
|
su nlvmi -c "ssh 192.168.0.199 \"RPID=\\\$(<\\\"$RUNDIRECTORY/$1.pid\\\"); ps -ef | grep -v grep | grep \\\$RPID\"" &>/dev/null && echo "VM is running" || echo "VM is not running"
|
||||||
|
else
|
||||||
ps -ef | grep `cat $RUNDIRECTORY/$1.pid` | grep -v grep >/dev/null && echo "VM is running" || echo "VM is not running"
|
ps -ef | grep `cat $RUNDIRECTORY/$1.pid` | grep -v grep >/dev/null && echo "VM is running" || echo "VM is not running"
|
||||||
|
|
||||||
|
fi
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
function listdir {
|
function listdir {
|
||||||
|
|
Loading…
Reference in New Issue