
Davmail Arch Linux init script
By: a guest on
Mar 19th, 2012 | syntax:
Bash | size: 0.71 KB | hits: 296 | expires: Never
#!/bin/bash
. /etc/rc.conf
. /etc/rc.d/functions
. /etc/profile.d/jre.sh
DAEMON=davmail
ARGS=/etc/davmail
PID=$(ps aux | grep java/davmail | grep -v grep | awk '{print $2}')
case "$1" in
start)
stat_busy "Starting $DAEMON"
[ -z "$PID" ] && nohup $DAEMON $ARGS >/dev/null 2>&1 &
if [ $? = 0 ]; then
add_daemon $DAEMON
stat_done
else
stat_fail
exit 1
fi
;;
stop)
stat_busy "Stopping $DAEMON"
[ -n "$PID" ] && kill $PID &>/dev/null
if [ $? = 0 ]; then
rm_daemon $DAEMON
stat_done
else
stat_fail
exit 1
fi
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "usage: $0 {start|stop|restart}"
esac