Thank you for the feedback Jon. :-) On 23/05/2012 09:12 AM, Jon Dowland wrote:
{ sleep 60; /data/backups/scripts/backup-disk-1.sh }& But I don't see why you even need the sleep.
I agree. I suspect using sleep will merely suspend udev operations as well.
should be backticks here so that date is evaluated e.g. start_date_time=`date +%Y-%m-%d-%H:%M:%S`
Thank you. Not being an experiences bash scripter, I always seem to get lost on the proper delimeters.
if -a /data/backups/${backup_description}-in-progress; then echo "FAIL ${backup_description} backup already in progress." exit 1 else touch /data/backups/${backup_description}-in-progress fiThere is a risk of race conditions here, if two instances of your script are fired off at similar times. E.g., whilst instance #1 has performed the check, instance #2 creates the file… Better would be a proper locking solution. (sorry I'm not offering one in this reply)
That is what I am trying to achieve by the progress file. I have noticed that sometimes with usb, the device is "discovered" multiple times. So I want to prevent multiple instances of the script. I will obviously need to find a better locking mechanism.
if ! mountpoint -q ${backup_target}/; thenrisk of races hereif ! mount ${backup_target}; thenand here
I am lost here. I thought that this would be a simple mountpoint check. Is there a better way to mount and check if the drive is mounted?
Kindest Regards Craig A. Adams