I would like to find out how to write Python code which sets up a process to run on startup, in this case level two.
I have done some reading, yet it has left me unclear as to which method is most reliable on different systems. I originally thought I would just edit /etc/inittab
with pythons fileIO, but then I found out that my computers inittab was empty.
What should I do? Which method of setting something to startup on boot is most reliable? Does anyone have any code snippets lying around?
I may as well answer my own question with my findings.
On Debian,Ubuntu,CentOS systems there is a file named /etc/rc.local. If you use pythons' FileIO to edit that file, you can put a command that will be run at the end of all the multi-user boot levels. This facility is still present on systems that use upstart.
On BSD I have no idea. If you know how to make something go on startup please comment to improve this answer.
Archlinux and Fedora use systemd to start daemons - see the Arch wiki page for systemd. Basically you need to create a systemd service and symlink it. (Thanks Emil Ivanov)