]> git.pld-linux.org Git - packages/sendmail.git/blame - sendmail.init
- official sec patch
[packages/sendmail.git] / sendmail.init
CommitLineData
56e84bcc 1#! /bin/sh
c81b1a7a 2#
3# sendmail This shell script takes care of starting and stopping
4# sendmail.
5#
56e84bcc 6# chkconfig: 2345 80 30
7# description: Sendmail is a Mail Transport Agent, which is the program \
8# that moves mail from one machine to another.
9# pidfile: /var/run/sendmail.pid
c81b1a7a 10
56e84bcc 11
12# Source function library
c81b1a7a 13. /etc/rc.d/init.d/functions
14
56e84bcc 15# Get network config
c81b1a7a 16. /etc/sysconfig/network
17
56e84bcc 18# Get service config
cbfcadea 19if [ -f /etc/sysconfig/sendmail ]; then
20 . /etc/sysconfig/sendmail
21else
22 DAEMON=yes
23 QUEUE=1h
24 ENABLE_IPV6=yes
25fi
c81b1a7a 26
56e84bcc 27# Check that networking is up.
7a537bd8 28if is_no "${NETWORKING}"; then
e905adcf 29 msg_network_down Sendmail
d402e605 30 exit 1
31fi
c81b1a7a 32
33# See how we were called.
34case "$1" in
35 start)
56e84bcc 36 # Check if the service is already running?
37 if [ ! -f /var/lock/subsys/sendmail ]; then
7a537bd8 38 show "Prepare sendmail db"
56e84bcc 39 busy
cbfcadea 40 /usr/bin/newaliases >/dev/null 2>&1
56e84bcc 41 for i in virtusertable access domaintable mailertable; do
42 if [ -f /etc/mail/$i ] ; then
d730b467 43 makemap -v hash /etc/mail/$i < /etc/mail/$i >/dev/null 2>&1
56e84bcc 44 fi
45 done
46 deltext;ok
7a537bd8 47 msg_starting sendmail
cbfcadea 48 daemon /usr/sbin/sendmail $([ "$DAEMON" = "yes" ] && echo -bd) \
49 $([ -n "$QUEUE" ] && echo -q$QUEUE) \
50 $([ "$ENABLE_IPV6" = "yes" ] &&
51 echo -ODaemonPortOptions=Family=inet6 )
52 RETVAL=$?
53 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/sendmail
56e84bcc 54 else
e905adcf 55 msg_already_running sendmail
7a537bd8 56 exit 1
c99e5551 57 fi
c81b1a7a 58 ;;
59 stop)
60 # Stop daemons.
7a537bd8 61 msg_stopping sendmail
c81b1a7a 62 killproc sendmail
cbfcadea 63 RETVAL=$?
64 [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/sendmail
c81b1a7a 65 ;;
56e84bcc 66 restart|reload)
c81b1a7a 67 $0 stop
68 $0 start
69 ;;
cbfcadea 70 condrestart)
71 if [ -f /var/lock/subsys/sendmail ]; then
72 stop
73 start
74 RETVAL=$?
75 fi
76 ;;
c81b1a7a 77 status)
78 status sendmail
cbfcadea 79 RETVAL=$?
c81b1a7a 80 ;;
81 *)
6bcb64ad 82 msg_usage "$0 {start|stop|restart|reload|condrestart|status}"
c81b1a7a 83 exit 1
84esac
85
cbfcadea 86exit $RETVAL
This page took 0.052073 seconds and 4 git commands to generate.