]>
Commit | Line | Data |
---|---|---|
1 | #!/bin/sh | |
2 | # POP3 Daemon | |
3 | # | |
4 | # chkconfig: 345 80 20 | |
5 | # description: POP3 Daemon | |
6 | ||
7 | sysconfdir=@sysconfdir@ | |
8 | libexecdir=@libexecdir@ | |
9 | sbindir=@sbindir@ | |
10 | ||
11 | # Source function library | |
12 | . /etc/rc.d/init.d/functions | |
13 | ||
14 | # Get network config | |
15 | . /etc/sysconfig/network | |
16 | ||
17 | # Check that networking is up. | |
18 | if is_yes "${NETWORKING}"; then | |
19 | if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then | |
20 | msg_network_down "Courier POP3" | |
21 | exit 1 | |
22 | fi | |
23 | else | |
24 | exit 0 | |
25 | fi | |
26 | ||
27 | RETVAL=0 | |
28 | # See how we were called. | |
29 | case "$1" in | |
30 | start) | |
31 | # Check if the service is already running? | |
32 | if [ ! -f /var/lock/subsys/courier-pop3 ]; then | |
33 | . $sysconfdir/pop3d | |
34 | msg_starting pop3d | |
35 | daemon $libexecdir/pop3d.rc start | |
36 | RETVAL=$? | |
37 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/courier-pop3 | |
38 | else | |
39 | msg_already_running pop3d | |
40 | fi | |
41 | ;; | |
42 | stop) | |
43 | if [ -f /var/lock/subsys/courier-pop3 ]; then | |
44 | . $sysconfdir/pop3d | |
45 | msg_stopping pop3d | |
46 | daemon $libexecdir/pop3d.rc stop | |
47 | RETVAL=$? | |
48 | rm -f /var/lock/subsys/courier-pop3 >/dev/null 2>&1 | |
49 | else | |
50 | msg_not_running pop3d | |
51 | fi | |
52 | ;; | |
53 | restart|force-reload) | |
54 | $0 stop | |
55 | $0 start | |
56 | exit $? | |
57 | ;; | |
58 | status) | |
59 | status couriertcpd | |
60 | exit $? | |
61 | ;; | |
62 | *) | |
63 | msg_usage "$0 {start|stop|restart|force-reload|status}" | |
64 | exit 3 | |
65 | esac | |
66 | ||
67 | exit $RETVAL |