Shell Script Launching Child Processes
Posted
by
Matt James
on Server Fault
See other posts from Server Fault
or by Matt James
Published on 2012-06-05T14:39:59Z
Indexed on
2012/06/06
4:42 UTC
Read the original article
Hit count: 449
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.
© Server Fault or respective owner