On Linux, the classic way would be through adding a script in the appropriate /etc/rcN.d/
directory (where N is a number 0-6 representing the 'run level'). I'm not sure whether that's still the recommended way, but it usually is still supported. This would also work with minor variations for other mainstream Unix variants (Solaris, HP-UX, AIX).
On Mac, you have to work harder. The files /etc/rc.common
, /etc/rc.imaging
and /etc/rc.netboot
are related, but there are no /etc/rcN.d
directories. There's also a script rc
and another rc.local
. Typing man rc
reveals:
DESCRIPTION
rc.local
is now unsupported and has been replaced with launchd(8), which bootstraps itself via the launchctl(1) bootstrap subcommand to read in launchd(8) jobs from the standard locations.
SEE ALSO
launchd(8), launchctl(1)
So, you should investigate launchctl
and launchd
, particularly launchctl
.