PDA

View Full Version : Startup a shell script as root




mehdies
Mar 10, 2013, 07:45 AM
I want to execute a shellscript as root once,i want this script execute when system restrats.how do this?



chown33
Mar 10, 2013, 08:31 PM
Use launchd. Specifically, make a plist for a LaunchDaemon. More specifically, read about the RunAtLoad key.

Required reading:
TN2083: Daemons and Agents (https://developer.apple.com/library/mac/#technotes/tn2083/_index.html)
launchd.plist man page (https://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man5/launchd.plist.5.html)

mehdies
Mar 12, 2013, 03:17 AM
Thanks chown33.going for test!