LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Adding a new daemon to startup (http://www.linuxquestions.org/questions/linux-newbie-8/adding-a-new-daemon-to-startup-41897/)

wayloud 01-18-2003 12:52 AM

Adding a new daemon to startup
 
I hope someone can help, as I have scoured google, and the forum but can't really find the answer I am looking for. I have recently installed clamav on my Red Hat 8.0 system and it runs like a champ. HOWEVER I want to enable this at boot time. I have added a script to the /etc/init.d directory, but I don't get how to get it recognized so that it A. starts a boot, and B. gets seen in the "Services" config tool in RH. There is a step that I am missing. For reference I have included the script that I found.

Thanks
Geoff


Script:
___________________
#! /bin/bash
#
# crond Start/Stop the clam antivirus daemon.
#
# chkconfig: 2345 90 60
# description: clamdis a standard UNIX program that scans for Viruses.
# processname: clamd
# config: /usr/local/etc/clamd.conf
# pidfile: /var/lock/subsys/clamd

# Source function library.
. /etc/init.d/functions

RETVAL=0

# See how we were called.
progdir=/usr/local/sbin
prog="clamd"

# Source configuration
if [ -f /etc/sysconfig/$prog ] ; then
. /etc/sysconfig/$prog
fi

start() {
echo -n $"Starting $prog: "
daemon $progdir/$prog
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/clamd
return $RETVAL
}

stop() {
echo -n $"Stopping $prog: "
killproc $prog
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/clamd
return $RETVAL
}

rhstatus() {
status clamd
}

restart() {
stop
start
}

reload() {
echo -n $"Reloading clam daemon configuration: "
killproc clamd -HUP
retval=$?
echo
return $RETVAL
}

case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
reload)
reload
;;
status)
rhstatus
;;
condrestart)
[ -f /var/lock/subsys/clamd ] && restart || :
;;
*)
echo $"Usage: $0 {start|stop|status|reload|restart|condrestart}"
exit 1
esac

exit $?

niknah 01-18-2003 02:38 AM

you need to make a link to this file in the /etc/rc.d/rc3.d/(if you boot up in text mode) or /etc/rc.d/rc5.d(if you boot up in gui)
name it something like S50clamav, where S50 is the order you want it to startup in, like S01 is the first thing to start in bootup and S99 is the last.

I've never used the redhat control panel so I don't know.

wayloud 01-18-2003 04:24 AM

Yep that did it, and it automatically appears in the "Services" config program. Thanks heaps!!!

Geoff


All times are GMT -5. The time now is 01:21 AM.