4

killproc not working on my daemon, returns 7.

view full story
linux-howto

http://forums.opensuse.org – Hello everyone, I'm running SLES10SP3/OES2SP2. I need to be able to get /sbin/killproc -TERM /root/Desktop/mydaemond to work, but it is not. This command causes nothing to be logged to /var/log/messages with the syslog() function written inside mydaemond for SIGTERM messages, and mydaemond does not terminate. However, correctly, if I do "kill <pid of mydaemond>", then this SIGTERM action is logged to /var/log/messages with the syslog() inside mydaemond, AND mydaemond terminates. 1. When I run /etc/rc.d/mydaemon start, mydaemond starts up fine. 2. But, I am not able to stop mydaemond with killproc. When I run /etc/rc.d/mydaemon stop, mydaemond does not stop. mydaemond is still listed as running in the output of ps ax | grep mydaemond 3. If I run /sbin/killproc -TERM /root/Desktop/mydaemond echo $? Then, 7 is displayed and mydaemond is still running. 7 returned for killproc = "Program was not running to receive the specified signal." See: 8:killproc - Linux Man Pages Manual Documentation for Linux / Solaris / UNIX / BSD Note: The contents of /var/run/mydaemond.pid is not the correct PID as shown in ps ax | grep mydaemond, probably because of the necessary fork()ing done in mydaemond. However, killproc is supposed to only need the full path to my executable (/root/Desktop/mydaemond) and not the PID number. Further, these SuSE /etc/rc.d/skeleton based scripts are supposed to work with daemons that should all have fork() in them at least once. Mine does fork()ing twice per the "Advanced Programming in the UNIX Environment, 2nd Edition" book. Help please. Thanks! Joe ------------------ (Distributions)