[one-users] start and shutdoen VMs - no problem, just trying to contribute

Francesco Camisa francesco.camisa at policlinicosanmarco.it
Thu Dec 20 10:48:57 PST 2012


I wrote these to very simple script to start and shutdown a few VMs that need to be up and/or shutdown in our cluster.

They work for us. Please forgive me if they don't work off the bat (my shop is Italian based so I had to translate them).

Here we go.

To start the VMs:

# start-core-vm


onetemplate="/usr/bin/onetemplate"
sleep="/bin/sleep"
seconds=150
vmliststart="<vm1> <vm2> ..."

for vm in $vmliststart
	do
		echo 'Do you want to start '$vm' ?'
		echo 
		echo "type\" yes \" , any other key to abort!"
		read -n 4 CONFIRMATION
		case "$CONFIRMATION" in
		yes|Yes|YES)
			$onetemplate instantiate $vm --name $vm
			echo 'wait '$seconds' seconds'
			$sleep $seconds
			;;
		*)
			echo -e "\n"
			echo ''$vm' was not started'
			echo -e "\n"
			;;
		esac
	done
exit 0

To stop the VMs:

# start-core-vm


onetemplate="/usr/bin/onetemplate"
sleep="/bin/sleep"
seconds=150
vmliststart="<vm1> <vm2> ..."

for vm in $vmliststart
	do
		echo 'Do you want to start '$vm' ?'
		echo 
		echo "type\" yes \" , any other key to abort!"
		read -n 4 CONFIRMATION
		case "$CONFIRMATION" in
		yes|Yes|YES)
			$onetemplate instantiate $vm --name $vm
			echo 'wait '$seconds' seconds'
			$sleep $seconds
			;;
		*)
			echo -e "\n"
			echo ''$vm' was not started'
			echo -e "\n"
			;;
		esac
	done
exit 0



Francesco Camisa
Vice Direttore Generale
Policlinico San Marco
via Zanotto 40
30173 Mestre-VE
Italy
tel +39 041 5071 618
fax +39 041 0998 956


More information about the Users mailing list