|
|
Mount / unmount external drive for Backup use
couple minor fixes -- namely when run by cron, it's probable you won't have a path, so we'll just use full path for diskutil/rsync. cheers.
--- backup.old 2007-06-08 02:35:45.000000000 -0700
+++ backup 2007-06-08 02:36:10.000000000 -0700
@@ -28,7 +28,7 @@
# ==> Backup using rsync to defined mountpoint:/path
# ...mount before backup, unmount when completed
-# version 0.9, this code is not supported.
+# version 0.9.1, this code is not supported.
#
# - create a .backup file on the destination (extra validation)
# - update the applicable variables: src/dst/name/log
@@ -36,11 +36,11 @@
# - how logging is done could be more pretty, but it's all good
#
# run via crontab(1) as needed:
-# * 2 * * * /path/to/script
+# 0 2 * * * /path/to/script
-SRC=/Volumes/
-DST=/Volumes/
+SRC=
+DST=
NAME=
log=
@@ -48,7 +48,7 @@
exit 1
-DEVICE=`diskutil list|grep $NAME|awk '{print $6}'`
+DEVICE=`/usr/sbin/diskutil list|grep $NAME|awk '{print $6}'`
PROC=`ps auwx | grep "rsync" | grep -v grep | wc -l`
TOP='1'
@@ -63,7 +63,7 @@
echo "=> Volume -> $NAME is already mounted" >> $log
if [ ! -f $DST/.backup ]; then
echo "=> ERROR: Volume did not mount properly (missing .backup?) - exiting" >> $log
- diskutil unmount /Volumes/$NAME
+ /usr/sbin/diskutil unmount /Volumes/$NAME
if [ -d $DST ]; then
rmdir $DST
fi
@@ -76,12 +76,12 @@
if [ -d $DST ]; then
rmdir $DST
fi
- diskutil mount /dev/$DEVICE
+ /usr/sbin/diskutil mount /dev/$DEVICE
if [ -f $DST/.backup ]; then
echo "=> Volume -> $NAME mounted properly" >> $log
else
echo "=> ERROR: Volume did not mount properly (missing .backup?) - exiting" >> $log
- diskutil unmount /Volumes/$NAME
+ /usr/sbin/diskutil unmount /Volumes/$NAME
if [ -d $DST ]; then
rmdir $DST
fi
@@ -94,10 +94,10 @@
fi
fi
echo "=> Starting rsync of $SRC to $DST" >> $log
- rsync --delete -av $SRC/* $DST >> $log
+ /usr/bin/rsync --delete -av $SRC/* $DST >> $log
echo "=> Rsync completed ..." >> $log
echo "=> Unmounting -> $NAME at /dev/$DEVICE" >> $log
- diskutil unmount /Volumes/$NAME
+ /usr/sbin/diskutil unmount /Volumes/$NAME
if [ -d $DST ]; then
rmdir $DST
fi
|
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.14 seconds |
|