]> git.pld-linux.org Git - packages/courier-imap.git/blob - courier-imap-pop3.init
- updated to 4.0.3
[packages/courier-imap.git] / courier-imap-pop3.init
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
34         POP3DSTART=""
35         POP3DSSLSTART=""
36
37         if test -f $sysconfdir/pop3d
38         then
39             . $sysconfdir/pop3d
40         fi
41
42         case x$POP3DSTART in
43         x[yY]*)
44         # Start daemons.
45         msg_starting pop3d
46         $libexecdir/pop3d.rc start
47         RETVAL=$?
48         if [ $RETVAL -eq 0 ]; then ok; else fail; fi
49         ;;
50         esac
51
52         if test -f $sysconfdir/pop3d-ssl
53         then
54         . $sysconfdir/pop3d-ssl
55         fi
56
57         case x$POP3DSSLSTART in
58         x[yY]*)
59         if test -x $COURIERTLS
60         then
61         # First time we start this, generate a dummy SSL certificate.
62         if test ! -f $TLS_CERTFILE
63         then
64         echo -n " generating-SSL-certificate..."
65         $sbindir/mkpop3dcert >/dev/null 2>&1
66         fi
67         msg_starting pop3d-ssl
68         $libexecdir/pop3d-ssl.rc start
69         RETVAL=$?
70         if [ $RETVAL -eq 0 ]; then ok; else fail; fi
71
72         fi
73         ;;
74         esac
75
76         touch /var/lock/subsys/courier-pop3
77         else
78                 msg_already_running "Courier POP3"
79         fi
80         ;;
81   stop)
82         if [ -f /var/lock/subsys/courier-pop3 ]; then
83
84         . $sysconfdir/pop3d
85         if [ -f $PIDFILE ]; then
86             msg_stopping pop3d
87             $libexecdir/pop3d.rc stop
88             RETVAL=$?
89             if [ $RETVAL -eq 0 ]; then
90                 ok
91                 rm -f $PIDFILE
92             else
93                 fail
94             fi
95         fi
96
97         . $sysconfdir/pop3d-ssl
98         if [ -f $SSLPIDFILE ]; then
99             msg_stopping pop3d-ssl
100             $libexecdir/pop3d-ssl.rc stop
101             RETVAL=$?
102             if [ $RETVAL -eq 0 ]; then
103                 ok
104                 rm -f $SSLPIDFILE
105             else 
106                 fail
107             fi
108         fi
109
110         rm -f /var/lock/subsys/courier-pop3
111         else
112                 msg_not_running "Courier POP3"
113         fi
114         ;;
115   restart|force-reload)
116         $0 stop
117         $0 start
118         exit $?
119         ;;
120   status)
121         status couriertcpd
122         exit $?
123         ;;
124   *)
125         msg_usage "$0 {start|stop|restart|force-reload|status}"
126         exit 3
127 esac
128
129 exit $RETVAL
This page took 0.058725 seconds and 3 git commands to generate.