I have recently installed Verlihub (a DC++ hub server) on Fedora 12. The install went fine and I can manually launch the service fine but I would like to configure it to run as a daemon. By this I mean I would like to be able to launch it with "#service verlihub start" or configure it to start automatically when the server starts up without having to log in as a user and launch it. The Verlihub website has directions to do this on Gentoo but it hasn't translated over to Fedora well for me. This is the init.d script provided on the Verlihub website.
Code:
#!/sbin/runscript
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# Verlihub boot script for gentoo distributions
depend() {
need net
need mysql
}
start() {
ebegin "Starting verlihub"
# make sure the configuration directory exists
if [[|! -d ${CONFDIR} ]]; then
eerror FATAL ERROR: missing configuration directory ${CONFDIR}
return 1
fi;
# check for the required files
for f in ${REQFILES}; do
file=${CONFDIR}/$f
if [[|! -e $file ]]; then
eerror "FATAL ERROR: missing required file $file"
return 1
fi;
done;
# check for the optional files
for f in ${OPTFILES}; do
file=${CONFDIR}/$f
if [[|! -e $file ]]; then
eerror "WARNING: missing file $file, some functionality will be disabled"
fi;
done;
# start the hub
start-stop-daemon --start --quiet --background --make-pidfile --pidfile ${VERLIPIDFILE} --exec ${VERLIBIN}
eend $?
}
stop () {
ebegin "Stopping verlihub"
# stop verlihub
start-stop-daemon --stop --pidfile ${VERLIPIDFILE}
eend $?
}
I am not super new to Linux, but other than trying to change the first line to !/bin/bash I am at a bit of a loss here. When I try running it, the system gets hung up on the syntax of line 16:
Code:
if [[|! -d ${CONFDIR} ]]; then
The Verlihub site also has code to put into /etc/conf.d but I have no such directory and I'm not sure that making it is the correct step.
I have played around in /etc/init.d as well as /etc/rc.local per suggestions I found searching online, but I still cannot seem to get it to work.
I understand that writing a full blown script to make the application work totally as a daemon may be out of the scope of possibility for now so even a solution to have the application launch as root when the computer boots would be helpful.
Any suggested directions would be greatly appreciated. Thanks in advance.