Posted on 10-26-2017 12:08 PM
I'm trying to make things really simple for our users with a script that does quite a few things, including enrolling them into the JSS. It seems to me that the easiest way to do this is to push a script onto the computer, put a LaunchDaemon entry into /Library/LaunchDaemons, and force a reboot.
Up to this point everything works fine.
However, rebooting AFTER the script does its thing invariably fails. The system log says:
com.apple.xpc.launchd[1] (mil.navy.spawar.sd.stage1[113]): Service exited with abnormal code: 2
The timestamp is precisely when the "shutdown -r now" command is issued in the script. The script's process does get shut down, but the computer does not get restarted, and I have no idea why.
Does anyone have any ideas as to what I can check?
Posted on 10-26-2017 01:20 PM
Maybe run the restart as a background task?
shutdown -r now &
Posted on 10-26-2017 01:28 PM
Or.
shutdown -r +1 &
This will give the script/daemon a minute to finish cleanly before restarting, I use this quite often in scripted policies because the built in restart in Casper seems to be rather unreliable.
Posted on 02-13-2023 01:33 AM
I still have this issue and can't work it out - did anyone resolve?