0

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
Joshua Enfield
  • 3,454
  • 8
  • 42
  • 59

2 Answers2

2

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.

cpbills
  • 2,720
  • 18
  • 12
  • 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
1

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
solefald
  • 2,301
  • 15
  • 14