Enabling services

Chris cpollock at embarqmail.com
Sat Jul 19 22:18:04 UTC 2014


On Sat, 2014-07-19 at 17:49 -0400, Tom H wrote:
> On Sat, Jul 19, 2014 at 5:00 PM, Chris <cpollock at embarqmail.com> wrote:
> >
> > I believe I've found the problem with getting Spamassassin to run. If I
> > run 'service --status-all I see:
> >
> > [ - ] spamassassin
> >
> > Which I would believe means that it's not enabled? In my old Mandriva
> > system all I'd need do is run chkconfig and then enable it from there I
> > see that instead an application called 'upstart' is used. I have in
> > my /etc/default folder this file:
> >
> > # /etc/default/spamassassin
> > # Duncan Findlay
> >
> > # WARNING: please read README.spamd before using.
> > # There may be security risks.
> >
> > # Change to one to enable spamd
> > ENABLED=1
> >
> > # Options
> > # See man spamd for possible options. The -d option is automatically
> > added.
> >
> > # SpamAssassin uses a preforking model, so be careful! You need to
> > # make sure --max-children is not set to anything higher than 5,
> > # unless you know what you're doing.
> >
> > OPTIONS="--create-prefs --max-children 5 --helper-home-dir"
> >
> > # Pid file
> > # Where should spamd write its PID to file? If you use the -u or
> > # --username option above, this needs to be writable by that user.
> > # Otherwise, the init script will not be able to shut spamd down.
> > PIDFILE="/var/run/spamd.pid"
> >
> > # Set nice level of spamd
> > NICE="--nicelevel 15"
> >
> > # Cronjob
> > # Set to anything but 0 to enable the cron job to automatically update
> > # spamassassin's rules on a nightly basis
> > CRON=1
> >
> > And in /etc/init.d this file:
> >
> > #! /bin/sh
> >
> > ### BEGIN INIT INFO
> > # Provides:       spamassassin
> > # Required-Start: $remote_fs
> > # Required-Stop:  $remote_fs
> > # Should-Start:   $network $syslog
> > # Default-Start:  2 3 4 5
> > # Default-Stop:   0 1 6
> > ### END INIT INFO
> >
> > # Spamd init script
> > # June 2002
> > # Duncan Findlay
> >
> > # Based on skeleton by Miquel van Smoorenburg and Ian Murdock
> >
> > PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
> > DAEMON=/usr/sbin/spamd:/usr/local/bin/spamd
> > NAME=spamd
> > SNAME=spamassassin
> > DESC="SpamAssassin Mail Filter Daemon"
> > PIDFILE="/var/run/$NAME.pid"
> > XNAME=/usr/bin/perl
> >
> > export TMPDIR=/tmp
> > # Apparently people have trouble if this isn't explicitly set...
> >
> > # Defaults - don't touch, edit /etc/default/spamassassin
> > ENABLED=0
> > OPTIONS=""
> > NICE=
> >
> > . /lib/lsb/init-functions
> >
> > test -f /etc/default/spamassassin && . /etc/default/spamassassin
> >
> > DOPTIONS="-d --pidfile=$PIDFILE"
> >
> > check_enabled() {
> >     if [ "$ENABLED" = "0" ]; then
> >         echo "$DESC: disabled, see /etc/default/spamassassin"
> >         exit 0
> >     fi
> > }
> >
> > test -f $DAEMON || exit 0
> >
> > set -e
> >
> > case "$1" in
> >   start)
> >         check_enabled
> >         echo -n "Starting $DESC: "
> >         start-stop-daemon --start --pidfile $PIDFILE --exec $XNAME \
> >             $NICE --oknodo --startas $DAEMON -- $OPTIONS $DOPTIONS
> >         echo "$NAME."
> >         ;;
> >
> >   stop)
> >         echo -n "Stopping $DESC: "
> >         start-stop-daemon --stop --pidfile $PIDFILE --exec $XNAME --oknodo
> >         echo "$NAME."
> >         ;;
> >
> >   reload|force-reload)
> >         check_enabled
> >         echo -n "Reloading $DESC: "
> >         start-stop-daemon --stop --pidfile $PIDFILE --signal HUP --exec $XNAME
> >         echo "$NAME."
> >         ;;
> >
> >   restart)
> >         check_enabled
> >         echo -n "Restarting $DESC: "
> >         start-stop-daemon --stop --pidfile $PIDFILE --exec $XNAME \
> >             --retry 5 --oknodo
> >         start-stop-daemon --start --pidfile $PIDFILE --exec $XNAME \
> >             $NICE --oknodo --startas $DAEMON -- $OPTIONS $DOPTIONS
> >
> >         echo "$NAME."
> >         ;;
> >   status)
> >         status_of_proc -p $PIDFILE $DAEMON $NAME && exit 0 || exit $?
> >         ;;
> >   *)
> >         N=/etc/init.d/$SNAME
> >         echo "Usage: $N {start|stop|restart|reload|force-reload|status}" >&2
> >         exit 1
> >         ;;
> > esac
> >
> > exit 0
> >
> > Spamd is located in /usr/local/bin as well as sa-update and spamc. I
> > believe the problem with getting SA to start is that it's not an enabled
> > service. I notice that clamav is running as well as freshclam and
> > checking service --status-all I see:
> >
> > [ + ] clamav-daemon
> > [ + ] clamav-freshclam
> >
> > Doing some reading about upstart I ran update-rc.d spamassassin enable S
> > 2 3 4 5 which showed an output of:
> >
> > Code:
> >
> >  Enabling system startup links for /etc/init.d/spamassassin ...
> >  Removing any system startup links for /etc/init.d/spamassassin ...
> >    /etc/rc0.d/K21spamassassin
> >    /etc/rc1.d/K21spamassassin
> >    /etc/rc2.d/S19spamassassin
> >    /etc/rc3.d/S19spamassassin
> >    /etc/rc4.d/S19spamassassin
> >    /etc/rc5.d/S19spamassassin
> >    /etc/rc6.d/K21spamassassin
> >  Adding system startup for /etc/init.d/spamassassin ...
> >    /etc/rc0.d/K21spamassassin -> ../init.d/spamassassin
> >    /etc/rc1.d/K21spamassassin -> ../init.d/spamassassin
> >    /etc/rc6.d/K21spamassassin -> ../init.d/spamassassin
> >    /etc/rc2.d/S19spamassassin -> ../init.d/spamassassin
> >    /etc/rc3.d/S19spamassassin -> ../init.d/spamassassin
> >    /etc/rc4.d/S19spamassassin -> ../init.d/spamassassin
> >    /etc/rc5.d/S19spamassassin -> ../init.d/spamassassin
> >
> > So now in rc0.d - rc5.d I have links to the spamassassin script
> > in /etc/init.d however the service still shows a [-] for the
> > spamassassin service.
> >
> > I have rebooted the system with no difference 'service --status-all
> > still shows a [-] for spamassassin. Not sure what I'm failing to do.
> 
> (Did you check that the links were actually created?)
> 
> The "DAEMON=/usr/sbin/spamd:/usr/local/bin/spamd" looks wrong because
> the later "test -f $DAEMON || exit 0" will fail.
> 
> If you've compiled your own spamassasin you should just use
> "/usr/local/bin/spamd" as the DAEMON.
> 

Tom, here's the link in rc5.d and they're also in the others.

root at localhost:/etc/rc5.d# ls -l
total 4
-rw-r--r-- 1 root root 677 Mar 12 20:42 README
lrwxrwxrwx 1 root root  22 Jul 19 12:05 S19spamassassin
-> ../init.d/spamassassin

I installed SA from CPAN because installing from the Ubuntu repository
kept failing. I changed that line in the /etc/init.d script and ran 

root at localhost:/# update-rc.d spamassassin enable S 2 3 4 5
update-rc.d: warning:  start runlevel arguments (none) do not match
spamassassin Default-Start values (2 3 4 5)
update-rc.d: warning:  stop runlevel arguments (none) do not match
spamassassin Default-Stop values (0 1 6)
 Enabling system startup links for /etc/init.d/spamassassin ...
 Removing any system startup links for /etc/init.d/spamassassin ...
   /etc/rc0.d/K21spamassassin
   /etc/rc1.d/K21spamassassin
   /etc/rc2.d/S19spamassassin
   /etc/rc3.d/S19spamassassin
   /etc/rc4.d/S19spamassassin
   /etc/rc5.d/S19spamassassin
   /etc/rc6.d/K21spamassassin
 Adding system startup for /etc/init.d/spamassassin ...
   /etc/rc0.d/K21spamassassin -> ../init.d/spamassassin
   /etc/rc1.d/K21spamassassin -> ../init.d/spamassassin
   /etc/rc6.d/K21spamassassin -> ../init.d/spamassassin
   /etc/rc2.d/S19spamassassin -> ../init.d/spamassassin
   /etc/rc3.d/S19spamassassin -> ../init.d/spamassassin
   /etc/rc4.d/S19spamassassin -> ../init.d/spamassassin
   /etc/rc5.d/S19spamassassin -> ../init.d/spamassassin

This time I got the errors shown. Did I forget to add an option?









More information about the ubuntu-users mailing list