Skip to content

Instantly share code, notes, and snippets.

@farhaven
Created June 15, 2014 18:50
Show Gist options
  • Save farhaven/15c7ca75ad06015edddf to your computer and use it in GitHub Desktop.
Save farhaven/15c7ca75ad06015edddf to your computer and use it in GitHub Desktop.
#!/bin/ksh
RSYNC="rsync -hPaHx"
backupdir="`pwd`"
now=`date +%Y-%m-%d-%H-%M`
echo $now
target=`find "$backupdir" -type d -maxdepth 1 -mindepth 1 | tail -n 1`
if [ "$target" != "$backupdir" ]; then
RSYNC="$RSYNC --link-dest $target"
fi
RSYNC="$RSYNC /etc /home /usr/ports/mystuff $backupdir/$now"
echo "rsync = $RSYNC"
echo "target= $target"
echo "now = $now"
mkdir "$now"
nice -n 20 $RSYNC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment