User Tools

Site Tools


blog:set_up_davmail_gateway

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
blog:set_up_davmail_gateway [2018-10-11 16:38] brbblog:set_up_davmail_gateway [2018-10-11 16:40] brb
Line 81: Line 81:
  
 <code class="code-pre">sudo nano /etc/init.d/davmail</code> <code class="code-pre">sudo nano /etc/init.d/davmail</code>
-Copy and paste the following into the file:+Copy and paste the following into the file: [[:files/davmail:]]
  
-<code class="code-pre">#! /bin/sh 
-### BEGIN INIT INFO 
-# Provides:          davmail 
-# Required-Start:    $remote_fs $syslog 
-# Required-Stop:     $remote_fs $syslog 
-# Default-Start:     2 3 4 5 
-# Default-Stop:      0 1 6 
-# Short-Description: DavMail Exchange gatway 
-# Description:       A gateway between Microsoft Exchange and open protocols. 
-    ### END INIT INFO 
  
-    # Author: Jesse TeKrony <jesse ~at~ jtekrony ~dot~ com> 
- 
-    PATH=/sbin:/usr/sbin:/bin:/usr/bin 
-    DESC="Davmail Exchange gateway" 
-    NAME=davmail 
-    CONFIG=/etc/davmail.properties 
-    DAEMON=/usr/bin/$NAME 
-    DAEMON_ARGS="$CONFIG" 
-    PIDFILE=/var/run/$NAME.pid 
-    SCRIPTNAME=/etc/init.d/$NAME 
-    LOGFILE=/var/log/davmail.log 
- 
-    # Exit if the package is not installed 
-    [ -x "$DAEMON" ] || exit 0 
- 
-    # Read configuration variable file if it is present 
-    [ -r /etc/default/$NAME ] && . /etc/default/$NAME 
- 
-    # Load the VERBOSE setting and other rcS variables 
-    . /lib/init/vars.sh 
- 
-    # Define LSB log_* functions 
-    . /lib/lsb/init-functions 
- 
-    # 
-    # Function that starts the daemon/service 
-    # 
-    do_start() 
-    { 
-        start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \ 
-            || return 1 
-        start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \ 
-            $DAEMON_ARGS >> $LOGFILE 2>&1 & 
-        [ $? != 0 ] && return 2 
-        echo $! > $PIDFILE 
-        exit 0 
-    } 
- 
-    # 
-    # Function that stops the daemon/service 
-    # 
-    do_stop() 
-    { 
-        start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE 
-        RETVAL="$?" 
-        [ "$RETVAL" = 2 ] && return 2. 
-        start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON 
-        [ "$?" = 2 ] && return 2 
-        rm -f $PIDFILE 
-        return "$RETVAL" 
-    } 
- 
-    case "$1" in 
-      start) 
-        [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" 
-        do_start 
-        case "$?" in 
-            0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; 
-            2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; 
-        esac 
-        ;; 
-      stop) 
-        [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" 
-        do_stop 
-        case "$?" in 
-            0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; 
-            2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; 
-        esac 
-        ;; 
-      status) 
-           status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? 
-           ;; 
-      restart|force-reload) 
-        log_daemon_msg "Restarting $DESC" "$NAME" 
-        do_stop 
-        case "$?" in 
-          0|1) 
-            do_start 
-            case "$?" in 
-                0) log_end_msg 0 ;; 
-                1) log_end_msg 1 ;; # Old process is still running 
-                *) log_end_msg 1 ;; # Failed to start 
-            esac 
-            ;; 
-          *) 
-            # Failed to stop 
-            log_end_msg 1 
-            ;; 
-        esac 
-        ;; 
-      *) 
-        echo "Usage: $SCRIPTNAME {start|stop|status|restart| force-reload}" >&2 
-        exit 3 
-        ;; 
-    esac</code> 
 Save and close the file. Save and close the file.
  
blog/set_up_davmail_gateway.txt · Last modified: 2018-10-11 16:40 by brb