]> git.pld-linux.org Git - packages/courier-imap.git/blame - courier-imap-pop3.init
- updated to 4.0.3
[packages/courier-imap.git] / courier-imap-pop3.init
CommitLineData
1986fe76 1#!/bin/sh
0e7557ae 2# POP3 Daemon
1986fe76 3#
4# chkconfig: 345 80 20
0e7557ae 5# description: POP3 Daemon
1986fe76 6
7efa8e76
AA
7sysconfdir=@sysconfdir@
8libexecdir=@libexecdir@
9sbindir=@sbindir@
dc7a4eaf 10
1986fe76 11# Source function library
12. /etc/rc.d/init.d/functions
13
14# Get network config
15. /etc/sysconfig/network
16
1986fe76 17# Check that networking is up.
0838e112 18if is_yes "${NETWORKING}"; then
ac84c9b5 19 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
0838e112 20 msg_network_down "Courier POP3"
21 exit 1
22 fi
23else
24 exit 0
1986fe76 25fi
26
d5f9e77f 27RETVAL=0
1986fe76 28# See how we were called.
29case "$1" in
30 start)
31 # Check if the service is already running?
0e7557ae 32 if [ ! -f /var/lock/subsys/courier-pop3 ]; then
dc7a4eaf
AA
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
1986fe76 77 else
0e7557ae 78 msg_already_running "Courier POP3"
1986fe76 79 fi
80 ;;
81 stop)
0e7557ae 82 if [ -f /var/lock/subsys/courier-pop3 ]; then
dc7a4eaf
AA
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
1986fe76 111 else
0e7557ae 112 msg_not_running "Courier POP3"
1986fe76 113 fi
114 ;;
d5f9e77f 115 restart|force-reload)
1986fe76 116 $0 stop
117 $0 start
d5f9e77f 118 exit $?
1986fe76 119 ;;
120 status)
121 status couriertcpd
d5f9e77f 122 exit $?
1986fe76 123 ;;
124 *)
d5f9e77f 125 msg_usage "$0 {start|stop|restart|force-reload|status}"
126 exit 3
1986fe76 127esac
128
129exit $RETVAL
This page took 0.052734 seconds and 4 git commands to generate.