Rodrigo OSORIO (ros) wrote:
Hi,
I'm trying to deal with a rc script I'm writing to launch a deamon.
I wrote it based on the hanbook rc script sample. It works pretty
well but I have some (strange to me) warning message.
Your script looks pretty good, but it needs a little work. :) I
assume that you wrote this based on the handbook examples for the
base. You should probably take a look at the one for ports too:
http://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/rc-scripts.html
Fisrt a short explanation about what i'm doing : The application is
a python script deamon started by a shell script located in
/usr/local/sbin/ntlmaps. The shell script launch the application
and write the pid file if require
So, the rc script (ntlmapsd)
The name of the script, the $name value, and the REQUIRE: value should
all match. So you should either name them all ntlmapsd, or ntlmaps.
There is no conflict between the script name and the binary in
/usr/local/sbin/, FYI.
calls the shell script with the right
arguments to start the application, then performs a 'kill -KILL' to
stop it based on the pid file information.
The thing is stopping the application I receive a message saying:
./ntlmapsd: WARNING: $command_interpreter -b != /bin/sh
This is a tricky one because what you did looks totally reasonable
since the script you're calling does use /bin/sh. However the
command_interpreter value for rc.d needs to be what the _process_ is
running, which in this case is /usr/local/bin/python.
I've attached an example script that might work for you. Personally I
would not make the pidfile stuff optional, in which case you could
simplify things to the one in -v2. Whatever you decide, please test it
thoroughly first.
In addition to the web pages another good resource is to read through
the comments in /etc/rc.subr.
hth,
Doug
--
This .signature sanitized for your protection
#!/bin/sh
#
# PROVIDE: ntlmaps
# REQUIRE: LOGIN
# KEYWORD: shutdown
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# ntlmaps_enable (bool): Set to NO by default.
# Set it to YES to enable ntlmaps.
# ntlmaps_nice (string): Set to -5 by default
# ntlmaps_pidfile (path): Set to /var/run/ntlmaps.pid by default
. /etc/rc.subr
name="ntlmaps"
rcvar=${name}_enable
command="/usr/local/sbin/ntlmaps"
command_interpreter="/usr/local/bin/python"
load_rc_config $name
ntlmaps_enable=${ntlmaps_enable-"NO"}
ntlmaps_nice=${ntlmaps_nice-"-5"}
ntlmaps_pidfile=${ntlmaps_pidfile-"/var/run/ntlmaps.pid"}
if [ -n "$ntlmaps_pidfile" ]; then
pidfile=${ntlmaps_pidfile}
command_args="-b -p $pidfile"
else
command_args="-b"
fi
run_rc_command "$1"
#!/bin/sh
#
# PROVIDE: ntlmaps
# REQUIRE: LOGIN
# KEYWORD: shutdown
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# ntlmaps_enable (bool): Set to NO by default.
# Set it to YES to enable ntlmaps.
# ntlmaps_nice (string): Set to -5 by default
. /etc/rc.subr
name="ntlmaps"
rcvar=${name}_enable
command="/usr/local/sbin/ntlmaps"
command_interpreter="/usr/local/bin/python"
pidfile=/var/run/ntlmaps.pid
command_args="-b -p $pidfile"
load_rc_config $name
ntlmaps_enable=${ntlmaps_enable-"NO"}
ntlmaps_nice=${ntlmaps_nice-"-5"}
run_rc_command "$1"
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"