]> git.pld-linux.org Git - packages/postfix.git/blame - postfix.init
- fixed requires (PR#48)
[packages/postfix.git] / postfix.init
CommitLineData
a281e397
AM
1#!/bin/sh
2#
3# postfix This shell script takes care of starting and stopping
4# postfix.
5#
563bd3a0 6# chkconfig: 2345 80 30
7#
8# description: Postfix is a Mail Transport Agent, which is the program
9# that moves mail from one machine to another.
10
a281e397 11
563bd3a0 12# Source function library
a281e397
AM
13. /etc/rc.d/init.d/functions
14
563bd3a0 15# Get network config
a281e397
AM
16. /etc/sysconfig/network
17
563bd3a0 18# Get service config
19[ -f /etc/sysconfig/postfix ] && . /etc/sysconfig/postfix
20
d2efe7d5 21# Check that networking is up.
22if [ "${NETWORKING}" = "no" ]; then
23 echo "WARNING: Networking is down. Postfix service can't be runed."
24 exit 1
25fi
26
a281e397
AM
27# See how we were called.
28case "$1" in
29 start)
563bd3a0 30 # Check if the service is already running?
31 if [ ! -f /var/lock/subsys/postfix ]; then
32 show Starting postfix
33 busy
34 newaliases
35 $0 rebuilddb
36 if /usr/sbin/postfix start 2>/dev/null; then
37 deltext; ok
38 else
320b372d 39 deltext; fail
563bd3a0 40 fi
a281e397 41 else
563bd3a0 42 echo "postfix already is running"
a281e397
AM
43 fi
44 touch /var/lock/subsys/postfix
45 ;;
46 stop)
47 # Stop daemons.
320b372d 48 show "Shutting down postfix"
a281e397
AM
49 busy
50 if /usr/sbin/postfix stop 2>/dev/null; then
563bd3a0 51 deltext; ok
a281e397 52 else
563bd3a0 53 deltext; fail
a281e397
AM
54 fi
55 rm -f /var/lock/subsys/postfix
56 ;;
57 restart)
58 $0 stop
59 $0 start
60 ;;
61 reload)
62 /usr/sbin/postfix reload
63 ;;
64 status)
65 status postfix
66 ;;
67 rebuilddb)
563bd3a0 68 for I in access canonical relocated transport virtual; do
69 if [ -f /etc/mail/$I ] ; then
70 /usr/sbin/postmap hash:/etc/mail/$I < /etc/mail/$I
71 fi
a281e397
AM
72 done
73 ;;
74 *)
563bd3a0 75 echo "Usage: $0 {start|stop|status|restart|reload|rebuilddb}"
a281e397
AM
76 exit 1
77esac
78
79exit 0
This page took 0.049456 seconds and 4 git commands to generate.