changed relaunch.sh, added own notify template

This commit is contained in:
mischa 2021-10-26 09:30:17 +02:00
parent 1788d3fd5e
commit aaf95dbec8
2 changed files with 27 additions and 13 deletions

View File

@ -162,7 +162,7 @@ my @files = glob "$conf{'conf'}{'VMS'}/*.txt";
if ($function =~ /notify/) {
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};
mailout(\%conf, \%slice);
} elsif ($function =~ /(renewal|subscription|deprovision)/) {
@ -187,5 +187,5 @@ if ($function =~ /notify/) {
}
mailout(\%conf, \%vms);
} 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";
}

View File

@ -29,17 +29,31 @@ if [[ ! -f "${VMS}/${1}.txt" ]]; then
echo "unable to find ${VMS}/${1}"
exit 1
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
vmctl reload
vmctl start ${1}
sleep 30
echo "SUCCES! - deployed ${1}"
cp -v /home/mischa/templates/email-deployed.txt-redeploy /home/mischa/templates/email-deployed.txt
/home/mischa/bin/notify.pl deployed ${1}
cp -v /home/mischa/templates/email-deployed.txt-orig /home/mischa/templates/email-deployed.txt
sleep 10
auto-deploy.exp ${1}
if [ $? != 0 ]; then
vmctl stop -f ${1}
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