sinisterporpoise: (Default)
[personal profile] sinisterporpoise
 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:

!/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
 
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.

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

Profile

sinisterporpoise: (Default)
sinisterporpoise

April 2019

S M T W T F S
 1234 56
78910111213
14151617181920
21222324252627
282930    

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jun. 27th, 2025 04:40 am
Powered by Dreamwidth Studios