![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
You can use crontab -e to run the script that come below this. Just add this line to it:
00 0 * * * /home/<yourhomedir>/Downloads/backup.sh
# This assumes you have left the file in your Downloads folder instead of moving it to a more appropriate place.
# The hashtag is just makes a line a comment in Linux/Unix scripts. (Mac OS X is Unix.)
Now, exit out of Crontab. On my Linux systems, Crontab uses nano, but many other Linux/Unix distributions use vi/vim.
Here is the script if you want to copy and paste it and put it itno a more convenient directory:
How does this differ from the previous versions? As written, it will only back up the home directories. For entire hard drive backups, simply switch it to the /home line to / . First, it creates multiple incremental backups. Second, unlike the previous versions, it excludes files that have been compressed into a tarball, as long as they have the .tar.gz extensions. Is this better than Time Machine for Mac users? No, probably not. However, it is a handy backup for it.
00 0 * * * /home/<yourhomedir>/Downloads/backup.sh
# This assumes you have left the file in your Downloads folder instead of moving it to a more appropriate place.
# The hashtag is just makes a line a comment in Linux/Unix scripts. (Mac OS X is Unix.)
Now, exit out of Crontab. On my Linux systems, Crontab uses nano, but many other Linux/Unix distributions use vi/vim.
Here is the script if you want to copy and paste it and put it itno a more convenient directory:
!/bin/bash
cat << EOF
-----------------------------------------------------------------------------
Sinister Porpoise Computing Backup Script
Test script for creating multiple
backup files.
Lara Landis
11/10/2017
Personal Bash Script
----------------------------------------------------------------------------
EOF
echo "Now creating backup files..."
x=1
y=1
if [[ -f "backup.tar.gz" ]]; then
x=1
while [ x==1 ]
do
if [[ -f "backup${y}.tar.gz" ]]; then
y=$((y+1))
echo $y
else
tar -czvf --exclude=*.tar.gz "backup${y}.tar.gz" /home
x=0
fi
done
else
tar -cvzf --exclude=*.tar.gz "backup.tar.gz" /home
fi