LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 01-18-2003, 12:52 AM   #1
wayloud
Member
 
Registered: Jan 2003
Location: Seattle, Washington
Distribution: Red Hat, OpenBSD
Posts: 33

Rep: Reputation: 15
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 $?
 
Old 01-18-2003, 02:38 AM   #2
niknah
Member
 
Registered: Dec 2002
Location: In front of a computer
Distribution: UPS, DHL, FedEx
Posts: 466

Rep: Reputation: 38
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.
 
Old 01-18-2003, 04:24 AM   #3
wayloud
Member
 
Registered: Jan 2003
Location: Seattle, Washington
Distribution: Red Hat, OpenBSD
Posts: 33

Original Poster
Rep: Reputation: 15
Talking

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

Geoff
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Any way to startup daemon automatically? Niceman2005 Linux - Newbie 2 01-12-2005 09:27 PM
adding a new daemon (service) vjenks Linux - Newbie 3 02-11-2004 07:31 PM
Startup Daemon on Boot EuroJovi Linux - Newbie 4 01-09-2004 10:39 AM
start daemon after gnome startup? jpbarto Linux - Software 1 08-17-2003 04:10 AM
Getting daemon to run at startup HaPPYFaCe Slackware 1 07-10-2003 08:50 PM


All times are GMT -5. The time now is 12:26 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration