Need help with backup shell script

Valerio Daelli valerio.daelli at
Wed Nov 21 08:13:32 PST 2007

> ---
> #!/bin/sh
> MOUNT=/external
> DATE=`date +%Y%m%d%H%M`
> mount /dev/da2 $MOUNT #Change device name
> find $MOUNT -mtime +30 -delete
> mkdir $MOUNT/$DATE
> cp -rp /backup/* $MOUNT/$DATE
> umount /external
> ---
Please substitute the line starting with 'cp' with this one:

rsync -rlpgoD /backup/ $MOUNT/$DATE

(you must portinstall rsync as well)
since 'cp -rp' preserve modification times as well while 'rsync -rlpgoD'
preserve permission but not mtime.

Valerio Daelli

More information about the freebsd-questions mailing list