Skip to main content
Solved

Help with LaunchD running script


ImAMacGuy
Forum|alt.badge.img+23

I've been using a process that was developed by macmule. It's mostly still working across the various OS's. However, I'm trying to get it to sync to an external drive rather than an internal drive. When I point the script to the external drive, the script seems to be running prior to the drive being registered, so the script is creating a folder in /Volumes and starts replicating. The drive then finishes mounting, but has a 1 appended to the end which makes it the wrong path. I tried adding a sleep timer but it didn't seem to work (shown).

I've tried

'"/Volumes/Peg...."'

and with various versions of ", `, and even manually putting the path in with \\ commands (.../Pegasus\\ -\\ SA)

 

Here's how it's setup now.

sleep 15 emailAlert=$(/usr/bin/rsync -avrpogz --delete --log-file=/private/var/log/rsync.log -e ssh ':"/Volumes/Promise RAID-File Share/CasperShare"' "/Volumes/Pegasus - SA")

 

Best answer by mm2270

You could adding an until block to check for the existence of the volume before proceeding with the rsync.

Like

until [ -e "/Volumes/Pegasus - SA" ]; do sleep 15 done emailAlert=$(/usr/bin/rsync -avrpogz --delete --log-file=/private/var/log/rsync.log -e ssh ':"/Volumes/Promise RAID-File Share/CasperShare"' "/Volumes/Pegasus - SA")

Not tested of course, so the above may or may not work, but the script should keep looping every 15 seconds until it successfully sees the volume mounted, then exit the loop and go ahead with the sync.

View original
Did this topic help you find an answer to your question?

2 replies

mm2270
Forum|alt.badge.img+16
  • Legendary Contributor
  • 7880 replies
  • Answer
  • July 15, 2021

You could adding an until block to check for the existence of the volume before proceeding with the rsync.

Like

until [ -e "/Volumes/Pegasus - SA" ]; do sleep 15 done emailAlert=$(/usr/bin/rsync -avrpogz --delete --log-file=/private/var/log/rsync.log -e ssh ':"/Volumes/Promise RAID-File Share/CasperShare"' "/Volumes/Pegasus - SA")

Not tested of course, so the above may or may not work, but the script should keep looping every 15 seconds until it successfully sees the volume mounted, then exit the loop and go ahead with the sync.


ImAMacGuy
Forum|alt.badge.img+23
  • Author
  • Esteemed Contributor
  • 1310 replies
  • July 15, 2021

This worked. thank you so much!

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings