-
Notifications
You must be signed in to change notification settings - Fork 3
/
davmail-sysvinit
60 lines (54 loc) · 1.42 KB
/
davmail-sysvinit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
# chkconfig: 2345 95 20
# description: DavMail gateway service
# Service implementing the DavMail gateway
# processname: java
#
# Source function library.
. /etc/init.d/functions
#Location where DavMail is installed (NO trailing slash!)
DAVMAIL_LOCATION="/opt/davmail"
#DavMail configuration file
DAVMAIL_CONF="$DAVMAIL_LOCATION/davmail.properties"
start() {
echo -n "Starting DavMail gateway: "
$DAVMAIL_LOCATION/davmail.sh $DAVMAIL_CONF 1>/dev/null 2>&1 &
touch /var/lock/subsys/davmail
success $"davmail startup"
echo ""
return 0
}
stop() {
echo -n "Shutting down DavMail gateway: "
kill $(pgrep -f $DAVMAIL_CONF) 1>/dev/null 2>&1
rm -f /var/lock/subsys/davmail
success $"davmail shutdown"
echo ""
return 0
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
if [[ "$(pgrep -f $DAVMAIL_CONF)" == "" && -f /var/lock/subsys/davmail ]]; then
echo "DavMail gateway dead but subsys locked"
elif [ "$(pgrep -f $DAVMAIL_CONF|wc -l)" == "1" ]; then
echo "DavMail gateway seems to be working fine..."
else
echo "DavMail gateway is NOT running."
fi
;;
restart)
stop
start
;;
*)
echo "Usage: <davmail> {start|stop|status|restart}"
exit 1
;;
esac
exit $?