Posted on 11-05-2014 12:11 PM
Hi Folks,
I have written a launchdaemon and I believe it is executing on first boot. However, I would like to wait until the second boot, as first boot after Casper Imaging, Casper is running its own tasks and I suspect the system is being restarted before my tasks are complete. How do I detect Casper's post-boot activity to avoid this conflict?
Here is the code of my launchdaemon. I called it com.orgname.firstboot instead of my actual institution's name just for illustration here. [Edited this post and removed LaunchOnlyOnce switch. I got some excellent feedback on that already.]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.orgname.firstboot</string>
<key>Disabled</key>
<true/>
<key>RunAtLoad</key>
<true/>
<key>ProgramArguments</key>
<array>
<string>/Library/AdminToolBox/on-firstboot.sh</string>
</array>
</dict>
</plist>
Solved! Go to Solution.
Posted on 11-05-2014 01:28 PM
Simplest way is to add your LaunchDaemon as a .dmg that is installed on reboot after imaging. This will bypass the initial RunAtLoad. Then after casper runs its on tasks on the first restart have it restart again, triggering your LaunchDaemon.
Posted on 11-05-2014 01:28 PM
Simplest way is to add your LaunchDaemon as a .dmg that is installed on reboot after imaging. This will bypass the initial RunAtLoad. Then after casper runs its on tasks on the first restart have it restart again, triggering your LaunchDaemon.
Posted on 11-05-2014 06:34 PM
I agree with @tron_jones
Posted on 11-07-2014 05:47 AM
Great idea, tron_jones, thank you. Simple is always best. I will try this out today.
Posted on 11-07-2014 06:45 AM
Just to clarify, it does not have to be a DMG file. A PKG can be set to load at reboot as well and will perform just as @tron_jones described.