Skip to content

Instantly share code, notes, and snippets.

@duchenpaul
Created October 6, 2015 11:41
Show Gist options
  • Save duchenpaul/fdcac1a866a80dcac82a to your computer and use it in GitHub Desktop.
Save duchenpaul/fdcac1a866a80dcac82a to your computer and use it in GitHub Desktop.
#!/bin/bash
TIMESTAMP=$(date +%F)
ssh -i /home/pi/.ssh/id_rsa_3072 root@192.168.31.240 <<'ENDSSH'
#commands to run on remote host
rm reaver_backup_*.zip;
zip -r ~/reaver_backup_`date +"%Y%m%d"`.zip /usr/local/etc/reaver;
scp -i /root/.ssh/id_rsa_3072 ~/reaver_backup*.zip pi@192.168.31.179:~/;
exit
ENDSSH
subject="Reaver Saving File Backup on $(date +%F)"
content="Here is the reaver saving file backup on `date "+%B %d %Y"`: reaver_backup_`date +"%Y%m%d"`.zip"
python /home/pi/run/send_mail.py "$subject" "$content" -f /home/pi/reaver_backup_*.zip
sudo rm /home/pi/reaver_backup_*.zip
logger "The reaver backup file: reaver_backup_`date +"%Y%m%d"`.zip has been sent"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment