Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Server Operation

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 7th May 2012, 13:21
Ovidiu Ovidiu is offline
Senior Member
 
Join Date: Sep 2005
Posts: 1,270
Thanks: 84
Thanked 25 Times in 21 Posts
Default installing archivesmtp on Debian Squeeze

archivesmtp: http://www.dancingfortune.com/projec...p/download.php

compiled and installed as explained on that page but when I try to get the script to start at boot-up I get these errors:

Code:
h1870666:~# insserv archivesmtp
insserv: warning: script 'K02jailkit' missing LSB tags and overrides
insserv: warning: script 'archivesmtp' missing LSB tags and overrides
insserv: warning: script 'jailkit' missing LSB tags and overrides
insserv: There is a loop between service munin-node and archivesmtp if stopped
insserv:  loop involving service archivesmtp at depth 2
insserv:  loop involving service munin-node at depth 1
insserv: Stopping archivesmtp depends on munin-node and therefore on system facility `$all' which can not be true!
insserv: exiting now without changing boot order!
h1870666:~#
any ideas how to fix this?
Reply With Quote
Sponsored Links
  #2  
Old 8th May 2012, 13:55
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,747 Times in 2,578 Posts
Default

Can you post the munin and archivesmtp init scripts?
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #3  
Old 9th May 2012, 09:33
Ovidiu Ovidiu is offline
Senior Member
 
Join Date: Sep 2005
Posts: 1,270
Thanks: 84
Thanked 25 Times in 21 Posts
Default

Sure I can do.

Here is the munin rc script, quite long and the original that comes with the Debian munin version...:
Code:
#! /bin/bash

### BEGIN INIT INFO
# Provides:          munin-node
# Required-Start:    $local_fs $remote_fs
# Required-Stop:     $local_fs $remote_fs
# Should-Start:      $all
# Should-Stop:       $all
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start/stop Munin-Node
# Description:       Start/stop Munin-Node
### END INIT INFO

PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/munin-node
PIDFILE=/var/run/munin/munin-node.pid
CONFFILE=/etc/munin/munin-node.conf

# log_daemon_msg() and log_progress_msg() isn't present in present in Sarge.
# Below is a copy of them from lsb-base 3.0-5, for the convenience of back-
# porters.  If the installed version of lsb-base provides these functions,
# they will be used instead.

log_daemon_msg () {
   if [ -z "$1" ]; then
       return 1
   fi

   if [ -z "$2" ]; then
       echo -n "$1:"
       return
   fi

   echo -n "$1: $2"
}

log_progress_msg () {
   if [ -z "$1" ]; then
       return 1
   fi
   echo -n " $@"
}

. /lib/lsb/init-functions
[ -r /etc/default/munin-node ] && . /etc/default/munin-node

if [ ! -x $DAEMON ]; then
       log_failure_msg "Munin-Node appears to be uninstalled."
       exit 5
elif [ ! -e $CONFFILE ]; then
       log_failure_msg "Munin-Node appears to be unconfigured."
       exit 6
fi

# Figure out if the pid file is in a non-standard location
while read line; do
       line=${line%%\#*} # get rid of comments
       set -f
       line=$(echo $line) # get rid of extraneous blanks
       set +f
       if [ "$line" != "${line#pid_file }" ]; then
               PIDFILE=${line#pid_file }
       fi
done < $CONFFILE

verify_superuser() {
       action=$1
       [ $EUID -eq 0 ] && return
       log_failure_msg "Superuser privileges required for the" \
                       "\"$action\" action."
       exit 4
}

start() {
       log_daemon_msg "Starting Munin-Node"
       mkdir -p /var/run/munin
       chown munin:root /var/run/munin
       chmod 0755 /var/run/munin
       if pidofproc -p $PIDFILE $DAEMON >/dev/null; then
               log_progress_msg "started beforehand"
               log_end_msg 0
               exit 0
       fi
       start_daemon -p $PIDFILE $DAEMON $DAEMON_ARGS
       ret=$?
       # start_daemon() isn't thorough enough, ensure the daemon has been
       # started manually
       attempts=0
       until pidofproc -p $PIDFILE $DAEMON >/dev/null; do
               attempts=$(( $attempts + 1 ))
               sleep 0.05
               [ $attempts -lt 20 ] && continue
               log_end_msg 1
               return 1
       done
       [ $ret -eq 0 ] && log_progress_msg "done"
       log_end_msg $ret
       return $ret
}

stop() {
       log_daemon_msg "Stopping Munin-Node"
       # killproc() doesn't try hard enough if the pid file is missing,
       # so create it is gone and the daemon is still running
       if [ ! -r $PIDFILE ]; then
               pid=$(pidofproc -p $PIDFILE $DAEMON)
               if [ -z "$pid" ]; then
                       log_progress_msg "stopped beforehand"
                       log_end_msg 0
                       return 0
               fi
               echo $pid 2>/dev/null > $PIDFILE
               if [ $? -ne 0 ]; then
                       log_end_msg 1
                       return 1
               fi
       fi
       killproc -p $PIDFILE /usr/bin/munin-node
       ret=$?
       # killproc() isn't thorough enough, ensure the daemon has been
       # stopped manually
       attempts=0
       until ! pidofproc -p $PIDFILE $DAEMON >/dev/null; do
               attempts=$(( $attempts + 1 ))
               sleep 0.05
               [ $attempts -lt 20 ] && continue
               log_end_msg 1
               return 1
       done
       [ $ret -eq 0 ] && log_progress_msg "done"
       log_end_msg $ret
       return $ret
}

if [ "$#" -ne 1 ]; then
       log_failure_msg "Usage: /etc/init.d/munin-node" \
                       "{start|stop|restart|force-reload|try-restart}"
       exit 2
fi

case "$1" in
 start)
       verify_superuser $1
       start
       exit $?
       ;;
 stop)
       verify_superuser $1
       stop
       exit $?
       ;;
 restart|force-reload)
       verify_superuser $1
       stop || exit $?
       start
       exit $?
       ;;
 try-restart)
       verify_superuser $1
       pidofproc -p $PIDFILE $DAEMON >/dev/null
       if [ $? -eq 0 ]; then
               stop || exit $?
               start
               exit $?
       fi
       log_success_msg "Munin-Node was stopped beforehand and thus not" \
                       "restarted."
       exit 0
       ;;
 reload)
       log_failure_msg "The \"reload\" action is not implemented."
       exit 3
       ;;
 status)
       pid=$(pidofproc -p $PIDFILE $DAEMON)
       ret=$?
       pid=${pid% } # pidofproc() supplies a trailing space, strip it
       if [ $ret -eq 0 ]; then
               log_success_msg "Munin-Node is running (PID: $pid)"
               exit 0
       # the LSB specifies that I in this case (daemon dead + pid file exists)
       # should return 1, however lsb-base returned 2 in this case up to and
       # including version 3.1-10 (cf. #381684).  Since that bug is present
       # in Sarge, Ubuntu Dapper, and (at the time of writing) Ubuntu Etch,
       # and taking into account that later versions of pidofproc() do not
       # under any circumstance return 2, I'll keep understanding invalid
       # return code for the time being, even though the LSB specifies it is
       # to be used for the situation where the "program is dead and /var/lock
       # lock file exists".
       elif [ $ret -eq 1 ] || [ $ret -eq 2 ]; then
               log_failure_msg "Munin-Node is dead, although $PIDFILE exists."
               exit 1
       elif [ $ret -eq 3 ]; then
               log_warning_msg "Munin-Node is not running."
               exit 3
       fi
       log_warning_msg "Munin-Node status unknown."
       exit 4
       ;;
 *)
       log_failure_msg "Usage: /etc/init.d/munin-node" \
                       "{start|stop|restart|force-reload|try-restart}"
       exit 2
       ;;
esac

log_failure_msg "Unexpected failure, please file a bug."
exit 1
Here is the original archivesmtp rc script:

Code:
#!/bin/sh
#
# Start up RC script for archivesmtp milter
#

# Please set these values to match your installation
ARCHIVESMTP="/usr/local/sbin/archivesmtp"
CONFIG_FILE="/usr/local/etc/archivesmtp.conf"
PID_FILE="/var/run/archivesmtp/run.pid"
SOCKET="unix:/var/run/archivesmtp/mta.sock"
CHUSER="nobody"
FLAGS=""

case "$1" in
        start)
                echo -n "Starting ArchiveSMTP"
                $ARCHIVESMTP $FLAGS -p $SOCKET -f $CONFIG_FILE -u $CHUSER -r $PID_FILE &
                echo
                ;;
        stop)
                echo -n "Stopping ArchiveSMTP" 
                kill `cat $PID_FILE`
                echo
                ;;
        *)
                echo "Usage: $0 {start|stop}"
                ;;
esac

exit
Here is an alternative archivesmtp rc script I got from tis author but it seems not to be Debian compatible either, at least not entirely:
Code:
#!/bin/bash
#
# Start up RC script for archivesmtp milter
#
# chkconfig: - 77 23
# description: archivesmtp is a daemon which hooks into sendmail \
#              and copies email messages in to a mailbox.
# processname: archivesmtp
# pidfile: /var/run/archivesmtp/run.pid
# config: /etc/archivesmtp.conf
 
. /etc/rc.d/init.d/functions
 
RETVAL=0
ARCHIVESMTP="/usr/sbin/archivesmtp"
CONFIG_FILE="/etc/archivesmtp.conf"
PID_FILE="/var/run/archivesmtp/run.pid"
SOCKET="unix:/var/run/archivesmtp/archivesmtp.sock"
CHUSER="archivesmtp"
FLAGS="-b -a"
 
start() {
    echo -n $"Starting ArchiveSMTP: "
    daemon --check archivesmtp $ARCHIVESMTP $FLAGS -p $SOCKET -f $CONFIG_FILE -u $CHUSER -r $PID_FILE
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/archivesmtp
    return $RETVAL
}
 
stop() {
    echo -n $"Shutting down ArchiveSMTP: "
    killproc archivesmtp
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/archivesmtp
    return $RETVAL
}
 
# See how we were called.
case "$1" in
  start)
       start
       ;;
  stop)
       stop
       ;;
  restart|reload)
       stop
       start
       RETVAL=$?
       ;;
  condrestart)
       if [ -f /var/lock/subsys/archivesmtp ]; then
           stop
           start
           RETVAL=$?
       fi
       ;;
    status)
       status archivesmtp
       RETVAL=$?
       ;;
    *)
       echo $"Usage: $0 {start|stop|restart|condrestart|status}"
       exit 1
esac
 
exit $RETVAL
Don't worry about the PATHs inside the scripts, I had adapted them but it was easier to post the original scripts here...

Last edited by Ovidiu; 9th May 2012 at 09:35.
Reply With Quote
  #4  
Old 11th May 2012, 10:34
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,747 Times in 2,578 Posts
Default

I suggest you try something like

Code:
### BEGIN INIT INFO
# Provides:          archivesmtp
# Required-Start:    $local_fs $remote_fs
# Required-Stop:     $local_fs $remote_fs
# Should-Start:      $all
# Should-Stop:       $all
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start/stop archivesmtp
# Description:       Start/stop archivesmtp
### END INIT INFO
in the original archivesmtp init script.
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
The Following User Says Thank You to falko For This Useful Post:
Ovidiu (13th May 2012)
Reply

Bookmarks

Tags
archivesmtp, debian squeeze, insserv

Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mail and FTP doesn´t work cyprus Installation/Configuration 15 18th April 2012 16:12
Installation just stops, and dies. cosmicsafari Installation/Configuration 3 19th July 2011 11:24
[debian 5 + ispconfig 3] Unable to send mail tanakskool HOWTO-Related Questions 6 4th November 2009 19:20
Bind Failed christoph2k HOWTO-Related Questions 4 28th April 2007 01:57
e-mail problem!!! Debian 3.1 maroonworks Installation/Configuration 18 6th December 2005 15:42


All times are GMT +2. The time now is 04:10.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.