Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

When I have a upstart script like..

exec start-stop-daemon --exec /tmp/test.sh --background --start 

I suppose will save the pid file somewhere and later use it for stop or restart, right?

So where is the pid file created by default?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Nowhere. Per the start-stop-daemon manpage:

Note: unless --pidfile is specified, start-stop-daemon behaves similar to killall(1). start-stop-daemon will scan the process table looking for any processes which match the process name, uid, and/or gid (if specified). Any matching process will prevent --start from starting the daemon. All matching processes will be sent the TERM signal (or the one specified via --signal or --retry) if --stop is specified. For daemons which have long-lived children which need to live through a --stop, you must specify a pidfile.

share|improve this answer
    
So you mean it will kill all "/tmp/test.sh" in the process list instead? –  Ryan Aug 8 '12 at 8:04
    
I suspect it will killall "test.sh", the path isn't usually part of the process name. –  DerfK Aug 8 '12 at 12:02
    
So seems it is not that reliable if using common scrpt name, e.g. server.sh... –  Ryan Aug 8 '12 at 14:10
    
In that case your script should create a pidfile somewhere when it is run, so you can use --pidfile /some/where with start-stop-daemon. Otherwise, if your script doesn't fork, then you can use --make-pidfile with --pidfile and start-stop-daemon will create one for you. –  DerfK Aug 8 '12 at 14:51
    
Even if I provide --pidfile, how start-stop-daemon know the location when it need to stop? Suppose this file should be stored somewhere? –  Ryan Aug 9 '12 at 6:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.