Disclaimer: I'm totally new to shell scripting, but have quite a bit of experience in other languages like PHP and Obj-C.
I'm writing my first daemon script. Here are the goals:
- I want it to run in the background
- I want it to be triggered by an init.d script that includes start/stop/restart commands
- I want each process in a loop to trigger its own subprocess.
- When the parent process kicked off by the init.d script is killed, I want the subprocesses to die as well.
Essentially, I'm looking for the same kind of behavior that appears to be very common among software like apache, spamd, dovecot, etc. But, based on my research, I haven't found a single, simple answer as to how this kind of thing is achieved.
Any help is greatly appreciated.