Dienstag, 28. Juni 2011

(OpenEMM) Init Script

Ich beschäftige mich ja relativ viel mit OpenEMM mittlerweile habe ich die Installation sogar im Griff :-)
Das einzige was mir zu meinem Glück fehlt ist ein Initscript so wie das hier

#!/bin/bash
# Openemm INIT Startup
# Author: Jörg Stephan <j@xadmin.info>
# Stand: 06. Sep 2010 DEBIAN
#

### BEGIN INIT INFO
# Provides:          openemm.sh
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start daemon at boot time
# Description:       Enable service provided by daemon.
### END INIT INFO

test -f /home/openemm/bin/OpenEMM.sh || exit 0

. /lib/lsb/init-functions


case "$1" in
start)  echo "Starting Openemm"
        su - openemm -c "/home/openemm/bin/OpenEMM.sh start"
        chmod 0644 /var/log/maillog
        log_end_msg $?
        ;;
stop)   echo "Stopping Openemm"
        su - openemm -c "/home/openemm/bin/OpenEMM.sh stop"
        log_end_msg $?
        ;;
restart) log_daemon_msg "Restarting Openemm"
        su - openemm -c "/home/openemm/bin/OpenEMM.sh stop"
        su - openemm -c "/home/openemm/bin/OpenEMM.sh start"
        chmod 0644 /var/log/maillog
         log_end_msg $?
        ;;
*)      log_action_msg "Usage: /etc/init.d/openemm.sh {start|stop|restart}"
        exit 2
        ;;
esac
exit 0