starting a linux script in deamon mode and terminating when requried
I need to start a linux script in a background in deamon mode and then kill it when requried. To that end I try the following
script.sh -daemon -p zpid
What I'm confused about the above is,
- What is the
-daemon
flag, I assume this says to start the process as a daemon. Is this the same as using-d
? - What does the
-p zpid
part do ? I assume it assigns the processID to thezpid
variable ? - How do I kill the process?
The -d represent the daemon and the -p is for naming the process id then you can use that name to find the process and stop it with this command ps aux | grep -i zipid
But I think its better to use screen
or tmux
as you can also see the output as well.