Goal: I want to have a script that will restart a system, if no user is logged in, or prompt a logged in user that their computer is going to be restarted in 30 minutes, and give them an option to postpone that restart.
I found the following script ( https://jamfnation.jamfsoftware.com/viewProductFile.html?fid=477 ), and it appears to work, except it always restarts after running for just 5 minutes.
If I copy the large chunk of AppleScript code into Script Editor, and run it there, it works fine for the full duration (30 minutes).
I have tried adding some pieces like "with timeout of 1800 seconds", but i get the same result. I have also tried on multiple OS's (10.11-10.9).
Could anyone clue me in on why the Applescript is acting differently when run from inside a .sh script?