rc5.d script is running but no responsefrom program

I am setting up a script to run FUPPES at boot time. I am used to using rc.local, but SUSE’s boot.local is run BEFORE the network is initiated, so that does not seem to be a good solution.

My solution: I took the /etc/init.d/skeleton script and went from there. Basically all I changed was the path to the executable (I’ll paste the script at the bottom of the post).
I set the Dependencies to $ALL and included a sleep 20 before the binary /usr/local/bin/fuppesd is executed because my wlan0 interface takes a few seconds to get DHCP done with. I set it to 20 just to be sure this was not the problem (as it had been before the addition of the sleep command).

To test the script out I run /etc/init.d/fuppesd_script start and it starts up and runs perfectly (status gives the right output, I can connect to the stream from my Xbox, and I can view the web interface.)

When I reboot the computer, however, the status is shown as running and a ps aux | grep fuppesd shows that the binary is running. I cannot, however, connect via my Xbox or load the web interface.

FUPPES depends on config files in ~/.fuppes, but if they are not present it will simply create a default set, so they do not seem to be missing.

Is there some debugging suggestions I should use? Am I missing an argument in the startproc line? Any help is much appreciated.

#!/bin/sh

### BEGIN INIT INFO
# Provides:          fuppes
# Required-Start:    $ALL
# Should-Start:      $time ypbind smtp
# Required-Stop:     $syslog $remote_fs
# Should-Stop:       ypbind smtp
# Default-Start:     3 5
# Default-Stop:      0 1 2 6
# Short-Description: FUPPES daemon
# Description:       Start FUPPES Media Server
### END INIT INFO

FOO_BIN=/usr/local/bin/fuppesd
test -x $FOO_BIN || { echo "$FOO_BIN not installed"; 
	if  "$1" = "stop" ]; then exit 0;
	else exit 5; fi; }

#FOO_CONFIG=/var/lib/fuppes/.fuppes/fuppes.cfg
#test -r $FOO_CONFIG || { echo "$FOO_CONFIG not existing";
#	if  "$1" = "stop" ]; then exit 0;
#	else exit 6; fi; }

#. $FOO_CONFIG

. /etc/rc.status

rc_reset

case "$1" in
    start)
	echo -n "Starting Fuppes "
	sleep 20
	/sbin/startproc $FOO_BIN
	rc_status -v
	;;
    stop)
	echo -n "Shutting down FUPPES "
	/sbin/killproc -TERM $FOO_BIN
	rc_status -v
	;;
    try-restart|condrestart)
	if test "$1" = "condrestart"; then
		echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
	fi
	$0 status
	if test $? = 0; then
		$0 restart
	else
		rc_reset
	fi
	rc_status
	;;
    restart)
	$0 stop
	$0 start
	rc_status
	;;
    force-reload)
	echo -n "Reload service FUPPES "
	/sbin/killproc -HUP $FOO_BIN
	rc_status -v
	;;
    reload)
	echo -n "Reload service FUPPES "
	/sbin/killproc -HUP $FOO_BIN
	rc_status -v
	;;
    status)
	echo -n "Checking for service FUPPES "
	/sbin/checkproc $FOO_BIN
	rc_status -v
	;;
    probe)
	test /etc/FOO/FOO.conf -nt /var/run/FOO.pid && echo reload
	;;
    *)
	echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
	exit 1
	;;
esac
rc_exit

Does your service generate any output? Can it be made to generate some output? Can you capture this debugging output in a file with a > /tmp/fuppes.log on the start line?

Did you start the script as yourself when testing? When booting, the script is run as root, so it would be using /root/.fuppes.

Is the network really ready at the time the service is started? Can you check this by running ifconfig or something just before fuppes and send the output to the debug file?

Thanks for the reply!

I added ifconfig > /tmp/fuppes0.log and /usr/local/bin/fuppesd > /tmp/fuppes1.log as you suggested.

I’m even more stumped now, though. According to the ifconfig output the network is definitely up. According to the binary’s output the program is running somewhat successfully since I’m getting the expected output. I am also getting, however, a message saying that the config files are not being found (although I have them placed accordingly in /root/.fuppes.

When I run this in the terminal (as root, mind you), the fuppes1.log shows that the program executes properly with all the necessary config files found…

I assumed that rc.d ran these as root, but I’m wondering now…

Edit: I just found a .fuppes directory (like the one generated by FUPPES when it runs for the first time) in system root (/). Why didn’t it put it in /root/ if that’s who it runs as?

Probably because fuppes uses $HOME to find the home directory instead of doing a lookup of /etc/passwd using the uid as the key, and when $HOME isn’t defined, it defaults to the current directory. When there is doubt about whether a service is reading the right config file, it’s best to use an option to force the config file, if the program provides one.

That’s a great point which I struggled with for a bit…

startproc doesn’t really have any place (that I could find in the man pages) for run arguments.

I wrestled with start-stop-daemon at first, because it claimed to have that ability, but it never like my arguments.

For the short-term I’ll simple declare $HOME in the script, but is there something I can pass to startproc so it accepts fuppes’ runtime arguments?

As the startproc man page explains, arguments to the program go after the program path, so in your script it would go after $FOO_BIN. You might like to declare $FOO_ARGS to hold any arguments, e.g.


FOO_ARGS='-c configfile -f option2 ...'

...

startproc ... $FOO_BIN $FOO_ARGS

Otherwise just put HOME=/root in front of the startproc, that will set HOME for that command only.

Thanks for all your help ken_yap.

I just out HOME=/root in there and it all worked.

I will have to switch to the startproc arguments variable like you showed me though.

Excellent. Have a lot of fun.