PDA

View Full Version : Init Script Help



NDog
13th February 2007, 07:06 AM
Hopefully, this is another simple fix.

I have been trying to set up an old computer to be an itunes server using tangerine-0.3.0, so far I have sucessfully compiled tangerine and gotten it up and running. Now I'd like it to act like a service that I can set the runlevels with using chkconfig.

My question is: How do I set it up such that I can use the 'service' command to control the program? i.e. 'service tangerine start' or 'service tangerine stop'

So far I have created a script in /etc/rc.d/init.d called tangerine (and made it executable). I can start tangerine just by typing 'tangerine' (not using the service command) and running 'service tangerine status' reports that it is running and I can stop it using 'service tangerine stop'. However, when I try to start the daemon with 'service tangerine start' I get the following error:

"Starting tangerine/bin/bash: tangerine: command not found"

The section in my init script for starting the daemon is as follows:

"case "$1" in
start)
echo -n "Starting tangerine"
daemon tangerine
echo
touch /var/lock/subsys/tangerine
;;
"

Any suggestions as to why the command 'tangerine isn't working in the script, but works fine when typed from the command line?

Any help is much appreciated.

marcrblevins
13th February 2007, 07:56 AM
You have this as your first line?
#!/bin/sh

And file is root:root ownership?
Started it as su -?

NDog
14th February 2007, 03:03 AM
Yes, I have that as my first line, and the file has the same ownerships as all of the other scripts in the directory, and I am attempting to start the service as root.

Here's the contents of the entire file:
"#!/bin/sh
#
# Startup script for tangerine daemon
#
# chkconfig: 345 85 15 - This statement tells the chkconfig command how to add or delete this process to the boot process
# description: tangerine is a daapd server for music distribution
# processname: tangerine


# Source function library. This creates the operating environment for the process to be started
. /etc/rc.d/init.d/functions

case "$1" in
start)
echo -n "Starting tangerine"
daemon tangerine
echo
touch /var/lock/subsys/tangerine
;;
stop)
echo -n "Shutting down tangerine"
killproc tangerine
echo
rm -f /var/lock/subsys/tangerine
;;
status)
status tangerine
;;
restart)
$0 stop
$0 start
;;
reload)
echo -n "Reloading tangerine"
killproc tangerine -HUP
echo
;;
*)
echo "Usage: $0 {start|stop|restart|reload|status}"
exit 1
esac

exit 0"