summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormischa <mischa@rx.high5.nl>2021-10-26 09:30:17 +0200
committermischa <mischa@rx.high5.nl>2021-10-26 09:30:17 +0200
commitaaf95dbec81c13035afd16d3c8dc711076ddae4b (patch)
treee297fb307943da2086f01333ac26a999dc759f8a
parent1788d3fd5eddcef272eee14d80fa64a1aff2249c (diff)
changed relaunch.sh, added own notify template
-rwxr-xr-xnotify.pl4
-rwxr-xr-xrelaunch.sh32
2 files changed, 25 insertions, 11 deletions
diff --git a/notify.pl b/notify.pl
index ee918bc..dfadbc1 100755
--- a/notify.pl
+++ b/notify.pl
@@ -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";
}
diff --git a/relaunch.sh b/relaunch.sh
index 5bf1da4..df8d272 100755
--- a/relaunch.sh
+++ b/relaunch.sh
@@ -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"
+
+deploy.pl
+rcctl restart dhcpd
+vmctl reload
+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
-/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-start.exp ${1}
+if [ $? ]; then
+ echo
+ echo "SUCCES! - re-deployed ${1}"
+ notify.pl redeployed ${1}
+ pushover.pl -m "$(hostname -s) ${1} re-deployed"
+fi