3 # opensmtpd This shell script takes care of starting and stopping
4 # OpenSMTPD on RedHat or other chkconfig-based system.
6 # chkconfig: 2345 80 30
8 # config: /etc/mail/smtpd.conf
9 # pidfile: /var/run/smtpd.pid
10 # description: OpenSMTPD is a Mail Transport Agent, which is the program \
11 # that moves mail from one machine to another.
13 # Source function library
14 . /etc/rc.d/init.d/functions
17 . /etc/sysconfig/network
19 # Check that networking is up.
20 if is_yes "${NETWORKING}"; then
21 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
22 msg_network_down "OpenSMTPd"
29 # Get service config - may override defaults
30 [ -f /etc/sysconfig/smtpd ] && . /etc/sysconfig/smtpd
32 pidfile="/var/run/smtpd.pid"
35 # Check if the service is already running?
36 if [ -f /var/lock/subsys/opensmtpd ]; then
37 msg_already_running "OpenSMTPd"
41 msg_starting "OpenSMTPd"
42 daemon /usr/sbin/smtpd
44 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/opensmtpd
48 if [ ! -f /var/lock/subsys/opensmtpd ]; then
49 msg_not_running "OpenSMTPd"
54 msg_stopping "OpenSMTPd"
55 killproc --pidfile $pidfile smtpd -TERM
56 rm -f /var/lock/subsys/opensmtpd
60 if [ ! -f /var/lock/subsys/opensmtpd ]; then
61 msg_not_running "OpenSMTPd"
71 # See how we were called.
90 status --pidfile $pidfile smtpd
94 msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"