I’ve written an AppleScript to restart a remote MacBook Pro using
do shell script "shutdown -r now” ...
It works fine on it’s own, but I want to use it in a Mail rule so I can reboot the Mac remotely by sending it an email. That’s where the problems start.
When the email comes in, the Mac reboots like it should. But then when Mail reopens, it checks for mail again and then reboots again. Now it’s in some kind of endless loop, and if I don’t disable the Mail rule, it will just keep rebooting.
This is on an older MacBook Pro running 10.6.8. The rule also marks the message as read and moves it to the trash.
It “appears” that the email isn’t fully received before the reboot is triggered. After the reboot happens a couple of times, and I disable the rule, then that email comes in completely.
Does anyone know what I need to do to get this to work? I know about setting up a schedule with cron or launchd, but I’d also like to get this to work, as well.
Thanks, Marc |