I have set up start-stop-daemon
to start my script automatically
case "$1" in
start)
log_begin_msg "starting foo"
start-stop-daemon --start --chuid nobody --user nobody --pidfile \
/tmp/foo.pid --startas /usr/local/bin/foo.sh &
log_end_msg $?
the problem is, it always returns 0 (success),even if the process was not started.
How can I capture the return code of start-stop-daemon
properly ?
start-stop-deamon
returns0
if the requested action was performed (note that it's not on if the process started). You can add some logic and usepidof
to matchpid
.