NTP restart needed with better locking

This commit is contained in:
DarkFeather 2017-02-13 20:33:58 -06:00
parent b73e1c3610
commit 62e0619988

View File

@ -1,16 +1,18 @@
#!/bin/bash #!/bin/bash
logfile=/var/log/wolfpack.log logfile=/var/log/wolfpack.log
lockdir="/tmp/offload-wolfpack-lock"
target='cxford@10.0.1.3' target='cxford@10.0.1.3'
mkdir "$lockdir"
if [ $? -ne 0 ]; then
echo "Wolfpack running elsewhere"
exit 1
fi
echo Starting VPN and delaying 40 seconds.... echo Starting VPN and delaying 40 seconds....
systemctl start vpn systemctl start vpn
sleep 40 sleep 40
echo | systemctl status | tee -a $logfile echo | systemctl status vpn | tee -a $logfile
if [ "$(pgrep -afc wolfpack)" -ne 1 ]; then
echo WolfPack is already working elsewhere.
exit 1
fi
/usr/local/bin/wolfpack --alpha /usr/local/bin/wolfpack --alpha
sleep 10 sleep 10
rsync -avz /srv/yggdrasil/new_acquisition/* cxford@10.0.1.3:/srv/yggdrasil/new_acquisition 2>&1 | tee -a $logfile rsync -avz /srv/yggdrasil/new_acquisition/* cxford@10.0.1.3:/srv/yggdrasil/new_acquisition 2>&1 | tee -a $logfile
@ -24,4 +26,5 @@ for i in $(ls /usr/local/etc/WolfPack/*.pup); do
scp "$i" "$target":"$cmdstring" scp "$i" "$target":"$cmdstring"
done done
systemctl stop vpn systemctl stop vpn
systemctl restart openntpd
rmdir "$lockdir"