vendredi 30 janvier 2015

Shutdown from launchd script no longer works in Yosemite


I'm new to this forum; please excuse any faux pas. I've been using rsync fired by a LaunchDaemon written in tcsh for several years now. It worked great on my 2008 MacBook Pro under Snow Leopard. I now have a 2014 MBP running Yosemite. I've cleared up a few conflicts, but one continues to elude me. My script works like this:



  1. I mount an external drive.

  2. launchd starts my script

  3. My script verifies that the right drive is available.

  4. My script copies some folders from my wife's computer to mine and from mine to hers.

  5. My script sends a shutdown command to my wife's computer.

  6. My script copies some folders from our backup computer to mine and from mine to it.

  7. My script sends a shutdown command to our backup computer.

  8. My script copies some folders from my computer to the external drive.


  9. My script sends a shutdown command to my computer.


    As I said, this worked fine for several years under Snow Leopard. Now that I'm running Yosemite, steps 4, 6 and 8 fail apparently without generating any errors. In the original script, I used osascript to launch an Applescript that checked a few things and then told System Events to shut down the computer. When this failed to work in Yosemite, I switched to a simple shutdown -h +1 command right in the tcsh script. This made step 8 work correctly, but did nothing for steps 4 and 6. Ideally, I would like to get back to the Applescript shutdown command because it seems cleaner: Applications get a chance to close out or even cancel the shutdown if necessary.


    One more point I should make is that I'm using ssh -f into the root user on the two other computers to send the shutdown commands. I've set the computers up with my computer's RSA keys to enable a passwordless login, so the current command is just ssh -f root@wife.local 'shutdown -h +1'.


    I have confirmed that it works to ssh to my wife's computer and shut it down manually. It is only the script that does not shutdown the other computer.


    Has anyone any idea of why this is not working in Yosemite. More importantly, any ideas of how to make it work? I would like to be able to set the backup running and then head to bed knowing that the computers will shut down when the process is completed.




Thanks in advance.





Aucun commentaire:

Enregistrer un commentaire