I have a command that is working fine if I executed it from the command line ... but when I put it in an init.d script it wont's start (well .. it starts but have a behavior different from that when it is run directly).
Any idea why this is not working on the init script ?
The command is : bluepill load /var/www/html/bluepill.conf
And the init.d script is :
#!/bin/sh
## Based on http://www.novell.com/coolsolutions/feature/15380.html
# chkconfig: 345 99 1
# processname: solr
# Provides: bluepill
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6
# Short-Description: bluepill daemon, providing process monitoring
# Description: Bluepill
# Check for missing binaries
BLUEPILL_BIN=/usr/local/bin/bluepill
test -x $BLUEPILL_BIN || { echo "$BLUEPILL_BIN not installed";
if [ "$1" = "stop" ]; then exit 0;
else exit 5; fi; }
# Check for existence of needed config file and read it
BLUEPILL_CONFIG=/var/www/html/bluepill.conf
test -r $BLUEPILL_CONFIG || { echo "$BLUEPILL_CONFIG not existing";
if [ "$1" = "stop" ]; then exit 0;
else exit 6; fi; }
case "$1" in
start)
echo -n "Starting bluepill "
$BLUEPILL_BIN load $BLUEPILL_CONFIG
;;
stop)
echo -n "Shutting down bluepill "
$BLUEPILL_BIN quit
;;
restart)
## Stop the service and regardless of whether it was
## running or not, start it again.
$0 stop
$0 start
;;
*)
## If no parameters are given, print which are avaiable.
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac
Update (to answer few questions) :
I also added the script in order to be executed at boot time using :
chkconfig --add bluepill_script
chkconfig --level 345 bluepill_script on