subscription logic changed for notify.pl

This commit is contained in:
mischa 2021-07-05 16:27:16 +02:00
parent a3ced25598
commit 35bfa8a28d
7 changed files with 21 additions and 7 deletions

View File

@ -53,5 +53,5 @@ if [ -f "/var/vmm/${1}.qcow2" ]; then
echo -n "Size of qcow2: "
ls -alh /var/vmm/${1}.qcow2 | awk '{print $5}'
echo "rsync -ve 'ssh -p 31415 -i ~mischa/.ssh/id_ed25519' --rsync-path='doas rsync' /var/vmm/${1}.qcow2 mischa@${2}.obsda.ms:/var/vmm/${3}.qcow2"
rsync -ve 'ssh -p 31415 -i ~mischa/.ssh/id_ed25519' --rsync-path='doas rsync' /var/vmm/${1}.qcow2 mischa@${2}.obsda.ms:/var/vmm/${3}.qcow2 && pushover.pl -m "rsync ${3} done"
rsync -ve 'ssh -p 31415 -i ~mischa/.ssh/id_ed25519' --rsync-path='doas rsync' /var/vmm/${1}.qcow2 mischa@${2}.obsda.ms:/var/vmm/${3}.qcow2 && pushover.pl -m "rsync ${3} to ${2} done"
fi

View File

@ -175,7 +175,7 @@ if ($function =~ /notify/) {
if (defined $vms{$vm_name}{'subscription'} and $vms{$vm_name}{'subscription'} =~ /yes/) { delete $vms{$vm_name}; next; }
}
if ($function =~ /subscription/) {
if (defined $vms{$vm_name}{'subscription'} and $vms{$vm_name}{'subscription'} eq "") { delete $vms{$vm_name}; next; }
if (!defined $vms{$vm_name}{'subscription'} or $vms{$vm_name}{'subscription'} eq "" or $vms{$vm_name}{'subscription'} =~ /no/) { delete $vms{$vm_name}; next; }
}
}
mailout(\%conf, \%vms);

View File

@ -34,12 +34,12 @@ if [[ ! -f "${IMAGES}/${1}.qcow2" ]]; then
exit 1
fi
deploy.pl
/home/mischa/bin/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
notify.pl deployed ${1}
/home/mischa/bin/notify.pl deployed ${1}
cp -v /home/mischa/templates/email-deployed.txt-orig /home/mischa/templates/email-deployed.txt

View File

@ -1,7 +1,7 @@
mac="fe:e1:ab:dd:73:a4"
ip="192.168.1.1"
owner="testuser1"
date="2018/05/02"
date="2018/07/02"
payment="70"
donated=""
name="Test1 User"

View File

@ -1,4 +1,4 @@
date="2018/02/02"
date="2018/07/02"
payment="70"
subscription=""
donated=""

View File

@ -1,4 +1,4 @@
date="2020/02/21"
date="2020/07/21"
payment="60"
subscription="yes"
donated=""

14
vms/vm04.txt Normal file
View File

@ -0,0 +1,14 @@
date="2020/07/21"
payment="60"
subscription="no"
donated=""
name="Test3"
email="vm03@high5.nl"
sshkey="ssh-ed25519 AAAAC3NzDI1NTE5AaaaIK7lMIQ4L4GcOyclKj9WLQPnHrGuP5ExjxZVmvLn"
hostname="deploytest3"
username="deploytest3"
note="here be dragons!"
memory="512M"
disk2=""
format="qcow2"
referral=""