Last active
May 18, 2018 18:06
-
-
Save Wingysam/8a7a602f952da4eac22c99c9a9baf012 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd ~ | |
mkdir -p .bin | |
cd .bin | |
if [ -e backup.sh ] | |
then | |
if [ "$(md5 backup.sh)" != "MD5 (backup.sh) = afbf604d948a59292a0fefe2a0c913cc" ] | |
then | |
echo uh oh. backup.sh exists | |
exit 1 | |
fi | |
fi | |
if [ -e backupall.sh ] | |
then | |
if [ "$(md5 backupall.sh)" != "MD5 (backupall.sh) = dd51aef83ce03ddc48ec3d72cf896303" ] | |
then | |
echo uh oh. backupall.sh exists | |
exit 1 | |
fi | |
fi | |
curl -s https://ghostbin.com/paste/2xdgs/raw > backup.sh | |
curl -s https://ghostbin.com/paste/mh4eg/raw > backupall.sh | |
tempfile=$(mktemp) | |
crontab -l > $tempfile 2> /dev/null # Dirty hack for if no crontab exists | |
echo "0 * * * * /Users/$(whoami)/.bin/backupall.sh > /dev/null" >> $tempfile | |
crontab $tempfile | |
rm $tempfile | |
echo 'Done :D Should backup once per hour now' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment