Shell – Using nohup at /etc/init.d/service

daemonservicesshell-script

I have been trying to create a daemon using /etc/init.d/myservice and it will call a shell script that contains nohup within the script line.

Will it affect it if I could do service stop later?

Best Answer

Nohup just blocks SIGHUP. The rc script to start or stop your daemon could use any signals at all to shut down your process.

This link has a good overview of the things a daemon process needs to do on startup, for example closing stdin, stdout and stderr, detaching itself from the parent and getting a new process group and setting up signal handlers.

Related Question