John M. Brown wrote:

Found them...but no author info...

Please see attached (you may have to modify the PATHS)

Those init scripts seem to be non-portable. I don't think they will work in my environment (Debian 3.0) because for us Debian users there is no /etc/rc.d directory. I have attached the init scripts I use, which should be more portable (although on Red Hat they will not have the nice colored "[ OK ]" on the right at startup). The scripts run in /bin/sh and have no shell script dependencies. All paths are defined using four environment variables. The scripts support dynamic linking against database libraries, and use both the LIBPATH and LD_LIBRARY_PATH environment variables to maximize shared object portability.

As far as I can tell, the only serious drawback to the init scripts I've included is the use of the "killall" command to stop the IMAP and POP3 services (but the previous Red Hat init scripts also appear to do this). If there are other processes whose names contain "dbmail-imapd" or "dbmail-pop3d" for some reason, they will be killed too.

Feature request for 2.0! Ideally the two servers should be enhanced to provide a command line option "-p $PIDFILE", or something like it, and write the parent process' pid to the specified location at startup. Then the stop verb of the init script would be changed to simply "kill `cat $PIDFILE`". If I find time in the next couple of days, I may make these changes myself and submit them. (Or is there a clever shell script hack to do this?)

--
Will Berry
Co-founder, Second Brain website hosting
http://www.secondbrainhosting.com/

#!/bin/sh
# init script for the DBMail IMAP server
# you may need to make some changes to the following paths

# directory where the IMAP server executable resides
PROGDIR=/usr/local/bin

# directory containing database shared libraries
# - multiple directories separated by a colon (':') are acceptable
# - if the IMAP server is statically linked, you may comment this out
DBLIBDIR=/usr/local/mysql/lib/mysql

# fully qualified filename of the DBMail configuration file
CONFIGFILE=/etc/dbmail.conf

# directory where the process ID of the IMAP server should be stored
# (this feature is not yet supported by DBMail)
PIDDIR=/var/run

##############################################################################
########### you should not have to change anything below this line ###########
##############################################################################

PROGRAM=dbmail-imapd
PIDFILE=$PIDDIR/$PROGRAM.pid
PATH=$PROGDIR:$PATH
export LD_LIBRARY_PATH=$DBLIBDIR:$LD_LIBRARY_PATH
export LIBPATH=$DBLIBDIR:$LIBPATH

# hopefully someday a pid file will be supported
# OPTS="-f $CONFIGFILE -p $PIDFILE"
OPTS="-f $CONFIGFILE"

test -x $PROGDIR/$PROGRAM || exit 0

case "$1" in
    start)
        echo -n "Starting DBMail IMAP daemon ($PROGRAM) ... "
        $PROGRAM $OPTS
        echo "done."
    ;;

    stop)
        echo -n "Stopping DBMail IMAP daemon ... "
        killall $PROGRAM
        # maybe someday this will work...
        # kill `cat $PIDFILE`
        echo "done."
    ;;

    reload)
        $0 stop
        sleep 2
        $0 start
    ;;

    restart|force-reload)
        $0 reload
    ;;
    
    *)
        echo "Usage: $0 {start|stop|reload|restart|force-reload}" >&2
        exit 1
    ;;
esac

exit 0
#!/bin/sh
# init script for the DBMail POP3 server
# you may need to make some changes to the following paths

# directory where the POP3 server executable resides
PROGDIR=/usr/local/bin

# directory containing database shared libraries
# - multiple directories separated by a colon (':') are acceptable
# - if the POP3 server is statically linked, you may comment this out
DBLIBDIR=/usr/local/mysql/lib/mysql

# fully qualified filename of the DBMail configuration file
CONFIGFILE=/etc/dbmail.conf

# directory where the process ID of the POP3 server should be stored
# (this feature is not yet supported by DBMail)
PIDDIR=/var/run

##############################################################################
########### you should not have to change anything below this line ###########
##############################################################################

PROGRAM=dbmail-pop3d
PIDFILE=$PIDDIR/$PROGRAM.pid
PATH=$PROGDIR:$PATH
export LD_LIBRARY_PATH=$DBLIBDIR:$LD_LIBRARY_PATH
export LIBPATH=$DBLIBDIR:$LIBPATH

# hopefully someday a pid file will be supported
# OPTS="-f $CONFIGFILE -p $PIDFILE"
OPTS="-f $CONFIGFILE"

test -x $PROGDIR/$PROGRAM || exit 1


case "$1" in
    start)
        echo -n "Starting DBMail POP3 daemon ($PROGRAM) ... "
        $PROGRAM $OPTS
        echo "done."
    ;;

    stop)
        echo -n "Stopping DBMail POP3 daemon ... "
        killall $PROGRAM
        # hopefully someday this will work...
        # kill `cat $PIDFILE`
        echo "done."
    ;;

    reload)
        $0 stop
        sleep 2
        $0 start
    ;;

    restart|force-reload)
        $0 reload
    ;;
    
    *)
        echo "Usage: $0 {start|stop|reload|restart|force-reload}" >&2
        exit 1
    ;;
esac

exit 0

Reply via email to