Hi, I'm writing an rc script for a hand-made daemon. Got a problem with the pid file:
Why rc script see /var/run/perl_fcgi.pid but saying its not running? (((
Contents of /usr/local/etc/rc.d/perl_fcgi itself:
What's the problem, why does it not see the pidfile or process?
Code:
# /usr/local/etc/rc.d/perl_fcgi start
Starting perl_fcgi.
# ps axu|grep perl
nobody 57821 0.0 0.1 16796 4712 ?? SsJ 10:33AM 0:00.00 perl-fcgi-pm (perl5.10.1)
nobody 57822 0.0 0.1 16796 4716 ?? SJ 10:33AM 0:00.00 perl-fcgi (perl5.10.1)
nobody 57823 0.0 0.1 16796 4716 ?? SJ 10:33AM 0:00.00 perl-fcgi (perl5.10.1)
nobody 57824 0.0 0.1 16796 4716 ?? SJ 10:33AM 0:00.00 perl-fcgi (perl5.10.1)
# /usr/local/etc/rc.d/perl_fcgi stop
perl_fcgi not running? (check /var/run/perl_fcgi.pid).
# cat /var/run/perl_fcgi.pid
57821
# ps axu|grep `cat /var/run/perl_fcgi.pid`
nobody 57821 0.0 0.1 16796 4712 ?? IsJ 10:33AM 0:00.00 perl-fcgi-pm (perl5.10.1)
Contents of /usr/local/etc/rc.d/perl_fcgi itself:
Code:
#!/bin/sh
#
# PROVIDE: perl_fcgi
# REQUIRE: LOGIN
# KEYWORD: shutdown
. /etc/rc.subr
load_rc_config perl_fcgi
name=perl_fcgi
rcvar=`set_rcvar`
command=/store/scripts/perl_fcgi.pl
pidfile=/var/run/${name}.pid
# default to disable
perl_fcgi_enable=${perl_fcgi_enable:-"NO"}
run_rc_command "$1"