Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

As I understand I think I need to add something to init.d, but I am not sure what to add. At the moment to start clamav I have to do clamd start. I would like it as a service so I can start it on run level 3 as a service. I realize I could probably do this through a shell script in the right runlevel, but I would like to be able to use chkconfig to configure it.

I tried using the template mentioned to produce what is below, chkconfig still however does not list it:

#!/bin/bash
clamd           This starts and stops clamd.
chkconfig: 3
description: Clamd is a virus scanner.

processname: /usr/local/sbin/clamd/clamd
config: /etc/clamd.conf
pidfile: /var/run/clamd.pid
share|improve this question

2 Answers 2

up vote 2 down vote accepted

if you installed clamav from the repository, using yum, then the scripts should have been installed and configured, when you installed the package.

you can do something like ln -s /etc/init.d/clamd /etc/rc3.d/S90clamd, or, like you said, using chkconfig

but again, if you installed from a package, all this should have been done for you.

share|improve this answer
    
I installed from source. –  Joshua Enfield May 14 '10 at 19:43
    
any particular reason? i mean, if you're determined to do all this manually, so be it. the script you've created in /etc/init.d/ needs to be executable, and may need to be called rc.clamd or something, not sure how chkconfig identifies init scripts, but it should be named like the rest, and executable. –  cpbills May 14 '10 at 20:01
    
most of the time people install clamd from source because pre-packaged versions are usually way behind and freshclam complains loudly when you are slightly behind the latest stable. Couple of month's ago they stopped providing updates on 0.94 and it broke ALOT of Debian boxes.... –  solefald May 14 '10 at 21:13
1  
so why not install the package to get the init scripts, copy them, and then uninstall? –  cpbills May 15 '10 at 16:13

You can set it up a shell script AND be able to use chkconfig to configure it. Look at the top of the files in /etc/init.d/. They all have a template on top of the file that chkconfig understands. For example:

#!/bin/bash
#
# xinetd        This starts and stops xinetd.
#
# chkconfig: 345 56 50
# description: xinetd is a powerful replacement for inetd. \
#          xinetd has access control mechanisms, extensive \
#              logging capabilities, the ability to make services \
#              available based on time, and can place \
#              limits on the number of servers that can be started, \
#              among other things.
#
# processname: /usr/sbin/xinetd
# config: /etc/sysconfig/network
# config: /etc/xinetd.conf
# pidfile: /var/run/xinetd.pid
share|improve this answer
    
I added the attempted template modification to my op. –  Joshua Enfield May 14 '10 at 19:42
1  
those lines need to be commented out in the file, just like in my example above –  solefald May 14 '10 at 21:01
    
@josh, Have you run chkconfig afterwards? –  jneves May 15 '10 at 7:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.