Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- source=/home/
- target=/data/moos/homedirs/
- ##############################################################################################
- date=`date +%Y-%m-%d__%H-%M-%S`
- current=${target}current
- logDir=${target}logs/
- logFile=${logDir}backup_$date.log
- if [ ! -d "$logDir" ]
- then
- mkdir $logDir
- fi
- rsync -a -h --delete --log-file=$logFile --link-dest=$current $source ${target}$date-incomplete
- if [ $? -eq 0 ] ; then
- mv $target$date-incomplete ${target}$date
- cd ${target}
- rm ./current
- ln -s $date current
- touch $date
- fi
Advertisement
Add Comment
Please, Sign In to add comment