The rc.d file for this package is not working.
It fails to start, check, reload, and stop the daemon.
This is the original file.
------------
#!/bin/ksh
daemon="/usr/local/bin/authentication_milter"
daemon_flags="-d"
. /etc/rc.d/rc.subr
pexp="perl: authentication_milter:master"
rc_reload=NO
rc_cmd $1
-------------
This is my version of the file.
-------------
#!/bin/ksh
daemon="/usr/local/bin/authentication_milter"
daemon_flags="--prefix /etc/mail --pidfile /var/run/authentication_milter.pid"
. /etc/rc.d/rc.subr
pexp="perl: authentication_milter:parent"
rc_pre() {
mkdir -p /var/cache/authentication_milter;
mkdir -p /var/spool/authentication_milter;
mkdir -p /var/lib/authentication_milter;
}
rc_start() {
#rc_exec "${daemon} ${daemon_flags} -c start"; # does not detouch
rc_exec "${daemon} ${daemon_flags} -d"
}
rc_check() {
#pgrep -q -xf "${pexp}"; # default, fails
#pgrep -xf "perl: authentication_milter:parent"; # works
#pgrep -q -xf "perl: authentication_milter:parent"; # works
pexp="perl: authentication_milter:parent"; pgrep -xf "${pexp}"; # works
}
rc_stop() {
#pkill -xf "${pexp}"; # default, fails
rc_exec "${daemon} ${daemon_flags} -c stop"
}
rc_reload() {
#pkill -HUP -xf "${pexp}"; # default, fails
pexp="perl: authentication_milter:parent"; pkill -HUP -xf "${pexp}"; # works
}
rc_cmd $1
--------------
I moved the configuration inside /etc/mail for my own convenience; you can move
it back if you want.
This file works. It starts, checks, reloads, and stops the daemon.
You are welcome to replace the packaged file with my file.
Now, the problem.
As you can see from the comments, the variable pexp is not seen by rc_check,
rc_stop and rc_reload.
At the beginning of each section, I wrote its default command. When executed,
it fails.
If I prefix the command with the definition of pexp, then the command succeds.
Since pexp is used in other rc.d files, I assume it is working there, so what
makes it fail here?