sinisterporpoise: (Default)
This works on Linux, Unix and Mac OS X orlater, which I just checkeddoes have cron and the /etc/cronta file. It will create incremental backups.  For Mac users, this can be a way to add additional backups to Time Machine.

To schedule it regularly, you add the favorite line to the /etc/crontab file.   (I use Nano in Linux.)

02     00    *         *        *   /<path to dir>/bakup.sh

To make the script executable run the following commaind

chmod +x backup.sh


Now for the script:

#!/bin/bash
 
 
cat << here
 
-----------------------------------------------------------------------------
 
Sinister Porpoise Computing Backup Script
Test script for creating multiple
backup files.
 
Lara Landis
11/10/2017
Personal Bash Script
 
----------------------------------------------------------------------------
here
 
echo "Now creating backup files..."
 
x=1
y=1 
 
if -e [[ "backup.tar.gz" ]]; then
    x=1
    while (x=1)
    do
if -e [[ "backup" +y +".tar.gz" ]]; then
    x=1
    y=y+1
else 
  tar -czvf "backup" + y + ".tar.gz" /home
  x=0
fi
    done
else 
tar -cvzf "backuptar.gz" /home
fi;


There you go. It's just a simple script. 

Profile

sinisterporpoise: (Default)
sinisterporpoise

April 2019

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

Syndicate

RSS Atom

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jul. 1st, 2025 06:27 am
Powered by Dreamwidth Studios