crontab

Visual CRONTAB: http://www.corntab.com/pages/crontab-gui

===========================

===========================

http://www.pantz.org/software/cron/croninfo.html

# backup will run on 7th day of the month
0 0 7 * * cp -r -u -f /media/shares/ /media/backup/shares/ >>/var/log/cronrun

/root/backup.sh

#!/bin/sh
####################################
#
# Backup to NFS mount script.
#
####################################
# What to backup.
#backup_files="/root /srv /home /var/spool/mail /etc /boot /opt"
backup_files="/root /srv /home /var/spool/mail /etc /boot /opt"

# Create archive filename.
day=$(date +"%Y-%m-%d.%H-%M-%S")
servername=$(hostname -s)
archive_file="$servername.$day.tgz"

# Where to backup to.
env=01
#mount=/mnt/local/sdb1
mount=/mnt/nfs/fs-$env.sdb1
#dest="$mount/backup/$servername"
dest="$mount/backup"
mkdir -p $dest

fullpath=$dest/$archive_file
# Print start status message.
echo "Backing up $backup_files to $fullpath"
echo $(date)
echo

# Backup the files using tar.
#tar czf $fullpath $backup_files
tar czf $fullpath $backup_files
chmod 400 $fullpath

# Print end status message.
echo
#echo $(date)
echo "Backup finished"
date

# Long listing of files in $dest to check file sizes.
ls -lh $dest

read this: http://www.thegeekstuff.com/2010/09/rsync-command-examples/


Tag Cloud