changed relaunch.sh, added own notify template
This commit is contained in:
parent
1788d3fd5e
commit
aaf95dbec8
|
@ -162,7 +162,7 @@ my @files = glob "$conf{'conf'}{'VMS'}/*.txt";
|
||||||
|
|
||||||
if ($function =~ /notify/) {
|
if ($function =~ /notify/) {
|
||||||
mailout(\%conf, \%vms);
|
mailout(\%conf, \%vms);
|
||||||
} elsif ($function =~ /(deployed|msg|thanx)/ and $function_variable !~ /empty/) {
|
} elsif ($function =~ /(deployed|redeployed|msg|thanx)/ and $function_variable !~ /empty/) {
|
||||||
my %slice = %vms{$function_variable};
|
my %slice = %vms{$function_variable};
|
||||||
mailout(\%conf, \%slice);
|
mailout(\%conf, \%slice);
|
||||||
} elsif ($function =~ /(renewal|subscription|deprovision)/) {
|
} elsif ($function =~ /(renewal|subscription|deprovision)/) {
|
||||||
|
@ -187,5 +187,5 @@ if ($function =~ /notify/) {
|
||||||
}
|
}
|
||||||
mailout(\%conf, \%vms);
|
mailout(\%conf, \%vms);
|
||||||
} else {
|
} else {
|
||||||
print "usage: " . basename($0) . " [stopped | renewal | notify | deprovision] | [deployed | msg | thanx] <vmid>\n";
|
print "usage: " . basename($0) . " [stopped | renewal | notify | deprovision] | [deployed | redeployed | msg | thanx] <vmid>\n";
|
||||||
}
|
}
|
||||||
|
|
36
relaunch.sh
36
relaunch.sh
|
@ -29,17 +29,31 @@ if [[ ! -f "${VMS}/${1}.txt" ]]; then
|
||||||
echo "unable to find ${VMS}/${1}"
|
echo "unable to find ${VMS}/${1}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [[ ! -f "${IMAGES}/${1}.qcow2" ]]; then
|
|
||||||
echo "unable to find ${IMAGES}/${1}.qcow2"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
/home/mischa/bin/deploy.pl
|
deploy.pl
|
||||||
rcctl restart dhcpd
|
rcctl restart dhcpd
|
||||||
vmctl reload
|
vmctl reload
|
||||||
vmctl start ${1}
|
sleep 10
|
||||||
sleep 30
|
|
||||||
echo "SUCCES! - deployed ${1}"
|
auto-deploy.exp ${1}
|
||||||
cp -v /home/mischa/templates/email-deployed.txt-redeploy /home/mischa/templates/email-deployed.txt
|
if [ $? != 0 ]; then
|
||||||
/home/mischa/bin/notify.pl deployed ${1}
|
vmctl stop -f ${1}
|
||||||
cp -v /home/mischa/templates/email-deployed.txt-orig /home/mischa/templates/email-deployed.txt
|
rm -rf /var/vmm/${1}.qcow2
|
||||||
|
pushover.pl -m "$(hostname -s) ${1} failed deploy" -p 1
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
vmctl stop -f ${1}
|
||||||
|
fi
|
||||||
|
|
||||||
|
deploy.pl
|
||||||
|
rcctl restart dhcpd
|
||||||
|
vmctl reload
|
||||||
|
sleep 10
|
||||||
|
|
||||||
|
auto-start.exp ${1}
|
||||||
|
if [ $? ]; then
|
||||||
|
echo
|
||||||
|
echo "SUCCES! - re-deployed ${1}"
|
||||||
|
notify.pl redeployed ${1}
|
||||||
|
pushover.pl -m "$(hostname -s) ${1} re-deployed"
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in New Issue