I want to create a small script for my Linux system that would do some simple things on PC boot. The script is most likely going to be Python, but maybe I'll resort to C or shell.
The problem is that I'm a Windows developer, and the tutorials on the web look suspicious.
Some of them close all file descriptors, some don't, some implement restart, force-restart, some don't. With later ones seemingly being against the spec. Then there is the whole gid thing, that confuses me.
So basically, I don't know which script base I can use for a stable daemon, and which ones are works-on-my-machine-so-it's-correct type.
Then I stumbled upon http://manpages.ubuntu.com/manpages/hardy/man1/daemon.1.html which seems to be an official process that creates daemons, SAFELY. But then again, it's scripts in init.d that do the start-up, if I understand correctly, not existing processes.
Then there is "nice" which should be used for long running tasks, if I got it right, and probably some other gotchas.
So I'm lost here. Can anyone give me a few warnings, don'ts and maybe an idea where to look for the information online?
P.S. The script I'm going to call will have to call processes, does that mean the daemon will fork for each of them?