LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices



Reply
 
Search this Thread
Old 07-19-2014, 11:51 AM   #1
Toadman
Member
 
Registered: Aug 2002
Location: Texas
Distribution: Ubuntu 14.04 LTS
Posts: 172

Rep: Reputation: 15
Enabling services in Ubuntu 14.04


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:

Code:
# /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:

Code:
#! /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 a link to the spamassassin script in /etc/init.d however the service still shows a [-] for the spamassassin service.

What am I failing to do?

Thanks in advance for any advice/assistance.

Chris

Adding to this post, I'm now seeing this when running update-rc.d spamassassin enable S 2 3 4 5 I see:

Code:
root@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
I am so totally confused now the SA scripts are all in the correct rc0.d - rc5.d does this init info need to be uncommented?

### 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

Chris

Last edited by Toadman; 07-19-2014 at 08:52 PM.
 
Old 07-19-2014, 09:41 PM   #2
Toadman
Member
 
Registered: Aug 2002
Location: Texas
Distribution: Ubuntu 14.04 LTS
Posts: 172

Original Poster
Rep: Reputation: 15
It's running now, I really don't know what I did other than muck around with upstart. Consider it solved, for now
 
  


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
Secure routing and enabling services (Advantek Networks Router) odiseo77 Linux - Networking 0 10-04-2006 09:22 AM
LXer: Enabling and disabling services during start up in GNU/Linux LXer Syndicated Linux News 0 04-02-2006 06:33 AM
Enabling Services in Solaris 8 njugs79 Solaris / OpenSolaris 2 04-12-2005 12:48 PM
Enabling services on knoppix? jon_k Linux - Software 1 03-10-2004 06:55 PM


All times are GMT -5. The time now is 04:35 AM.

Main Menu
Advertisement
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