2016-08-04 12:08:16 -05:00
|
|
|
#!/bin/bash
|
|
|
|
|
2017-01-18 20:27:33 -06:00
|
|
|
logfile=/var/log/wolfpack.log
|
2017-02-13 20:33:58 -06:00
|
|
|
lockdir="/tmp/offload-wolfpack-lock"
|
2017-01-18 20:27:33 -06:00
|
|
|
target='cxford@10.0.1.3'
|
|
|
|
|
2017-02-13 20:33:58 -06:00
|
|
|
mkdir "$lockdir"
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "Wolfpack running elsewhere"
|
|
|
|
exit 1
|
|
|
|
fi
|
2017-01-18 20:27:33 -06:00
|
|
|
echo Starting VPN and delaying 40 seconds....
|
|
|
|
systemctl start vpn
|
|
|
|
sleep 40
|
2017-02-13 20:33:58 -06:00
|
|
|
echo | systemctl status vpn | tee -a $logfile
|
2016-08-04 12:08:16 -05:00
|
|
|
/usr/local/bin/wolfpack --alpha
|
|
|
|
sleep 10
|
2017-01-18 20:27:33 -06:00
|
|
|
rsync -avz /srv/yggdrasil/new_acquisition/* cxford@10.0.1.3:/srv/yggdrasil/new_acquisition 2>&1 | tee -a $logfile
|
|
|
|
ls -l /srv/yggdrasil/new_acquisition | tee -a $logfile
|
|
|
|
echo Files transferred from $(uname -n). | tee -a $logfile
|
2016-08-04 12:08:16 -05:00
|
|
|
rm -Rf /srv/yggdrasil/new_acquisition/*
|
2017-01-18 20:27:33 -06:00
|
|
|
cat $logfile | ssh cxford@aninix.net "cat >> $logfile"
|
|
|
|
rm $logfile
|
2016-08-04 12:08:16 -05:00
|
|
|
for i in $(ls /usr/local/etc/WolfPack/*.pup); do
|
|
|
|
export cmdstring="$(echo $i | sed "s/pup/$(uname -n)/")"
|
2017-01-18 20:27:33 -06:00
|
|
|
scp "$i" "$target":"$cmdstring"
|
2016-08-04 12:08:16 -05:00
|
|
|
done
|
2017-01-18 20:27:33 -06:00
|
|
|
systemctl stop vpn
|
2017-02-13 20:33:58 -06:00
|
|
|
systemctl restart openntpd
|
|
|
|
rmdir "$lockdir"
|