Subversion Repositories

?revision_form?Rev ?revision_input??revision_submit??revision_endform?

Rev 71 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 71 Rev 116
1
#!/bin/sh
1
#!/bin/sh
2
#
2
#
3
### BEGIN INIT INFO
3
### BEGIN INIT INFO
4
# Provides:          prayer-accountd
4
# Provides:          prayer-accountd
5
# Required-Start:    
5
# Required-Start:    $local_fs $remote_fs
6
# Required-Stop:     
6
# Required-Stop:     $local_fs $remote_fs
7
# Should-Start:      $local_fs
7
# Should-Start:      
8
# Should-Stop:       $local_fs
8
# Should-Stop:       
9
# Default-Start:     2 3 4 5
9
# Default-Start:     2 3 4 5
10
# Default-Stop:      0 1 6
10
# Default-Stop:      0 1 6
11
# Short-Description: Prayer account helper daemon
11
# Short-Description: Prayer account helper daemon
12
# Description:       Lets users change passwords, manage filters and other things not supported by IMAP itself
12
# Description:       Lets users change passwords, manage filters and other things not supported by IMAP itself
13
### END INIT INFO
13
### END INIT INFO
14
14
15
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
15
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
16
DAEMON=/usr/sbin/prayer-accountd
16
DAEMON=/usr/sbin/prayer-accountd
17
PIDFILE=/var/run/prayer-accountd.pid
17
PIDFILE=/var/run/prayer-accountd.pid
18
DESC="Prayer account helper server"
18
DESC="Prayer account helper server"
19
19
20
test -x $DAEMON || exit 0
20
test -x $DAEMON || exit 0
21
21
22
egrep -iq "^[[:space:]]*accountd_port[[:space:]]*=[[:space:]]*[[:digit:]]+[[:space:]]*$" /etc/prayer/accountd.cf || exit 0
22
egrep -iq "^[[:space:]]*accountd_port[[:space:]]*=[[:space:]]*[[:digit:]]+[[:space:]]*$" /etc/prayer/accountd.cf || exit 0
23
23
24
. /lib/lsb/init-functions
24
. /lib/lsb/init-functions
25
25
26
# Include prayer defaults if available
26
# Include prayer defaults if available
27
if [ -f /etc/default/prayer-accountd ] ; then
27
if [ -f /etc/default/prayer-accountd ] ; then
28
	. /etc/default/prayer-accountd
28
	. /etc/default/prayer-accountd
29
fi
29
fi
30
30
31
set +e
31
set +e
32
32
33
start() {
33
start() {
34
    log_daemon_msg "Starting $DESC" "accountd"
34
    log_daemon_msg "Starting $DESC" "accountd"
35
    start-stop-daemon --start --background --make-pidfile --pidfile $PIDFILE \
35
    start-stop-daemon --start --background --make-pidfile --pidfile $PIDFILE \
36
	--exec $DAEMON -- $DAEMON_OPTS
36
	--exec $DAEMON -- $DAEMON_OPTS
37
    log_end_msg $?
37
    log_end_msg $?
38
}
38
}
39
39
40
stop() {
40
stop() {
41
    log_daemon_msg "Stopping $DESC" 
41
    log_daemon_msg "Stopping $DESC" 
42
    if [ -f "$PIDFILE" ]; then
42
    if [ -f "$PIDFILE" ]; then
43
	start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE
43
	start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE
44
	log_progress_msg "accountd"
44
	log_progress_msg "accountd"
45
    fi
45
    fi
46
    rm -f "$PIDFILE"
46
    rm -f "$PIDFILE"
47
    log_end_msg 0
47
    log_end_msg 0
48
}
48
}
49
49
50
case "$1" in
50
case "$1" in
51
  start)
51
  start)
52
	start
52
	start
53
	;;
53
	;;
54
54
55
  stop)
55
  stop)
56
	stop
56
	stop
57
	;;
57
	;;
58
58
59
  restart|force-reload)
59
  restart|force-reload)
60
	stop
60
	stop
61
	sleep 1
61
	sleep 1
62
	start
62
	start
63
	;;
63
	;;
64
  *)
64
  *)
65
	N=/etc/init.d/prayer-accountd
65
	N=/etc/init.d/prayer-accountd
66
	# echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
66
	# echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
67
	log_failure_msg "Usage: $N {start|stop|restart|force-reload}" >&2
67
	log_failure_msg "Usage: $N {start|stop|restart|force-reload}" >&2
68
	exit 1
68
	exit 1
69
	;;
69
	;;
70
esac
70
esac
71
71
72
exit 0
72
exit 0