I have a shell script that is run by an AppleScript app.
That shell script restarts the machine at some point with shutdown -r now
.
How can I avoid having the AppleScript application automatically launch itself again after the reboot?
- The app is not included in the startup items
- The app is launched again just like any other open app when the shell script restarts OS X
The sequence is this:
- I double click on the AppleScript app
- AppleScript launches a shell script in Terminal
- The shell script, at some point, reboots the system
- The AppleScript app starts again after the reboot
Best Answer
Have your AppleScript write an empty file to a predefined location and test for its existance when the script starts. If the file is already there, delete it and quit the script; otherwise proceed as normal and reboot.