Return to Snippet

Revision: 69417
at June 16, 2015 12:13 by brm


Initial Code
#!/bin/sh

mtnpnt="/mnt/hd/"

src="/dir/"

disk="/dev/sd"

dest="/mnt/usb_harddrive/dest/"

if grep '/mnt/hd' /etc/mtab > /dev/null 2>&1; then

   echo "already mount... - $(date)" > logfile

   rsync -avm $src --exclude-from=/dir/exclude-file $dest >> logfile

   df -h >> logfile

   umount $disk

else

  echo "not mount ... - $(date)" > logfile

  mount $disk $mntpnt

  if grep '/mnt/hd" /etc/mtab > /dev/null 2>&1; then

     echo "mount by script... - $(date) >> filelog

     rsync -avm $src --exclude-from="/dir/exclude-file $dest >> logfile

     df -h >> logfile

  else

     echo "failed .. - $(date)" > filelog

  fi

fi

Initial URL


Initial Description
Simple backup script using Rsync

Initial Title
Backup script using rsync

Initial Tags
backup

Initial Language
Bash