Jump to content

Easy backups (aka "xaff has a go at shellscripting&quot


Guest xaff
 Share

Recommended Posts

I decided that I needed a backup routine for my webstuff, so I decided to make a small shell script to do it. (I swear to god, small shell scripts are going to rule the earth one day.)

 

#

# These are the only settings that you need to care about

#

  # Define what to back up

backup="/home/*/public_html/";

  # Define where to put it

backupdir="/home/xaff/backup/";

  # Define a short reference name for the archives

type="web";





#

# Nothing to see here.. :P

#

timestamp=`date '+%Y-%b-%a-%d'`;

backupname="$backupdir$type-$timestamp.tar";



tar -cf $backupname $backup

 

Now to crontab it.. :mystismiles:

 

Edit: Either I did it wrong, or it was easy.

 

crontab -e



0 0 * * 1,3,5,7 sh /home/xaff/scripts/backup.sh

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...