File: sendmail-init.d

package info (click to toggle)
mailscanner 3.13.2-4
  • links: PTS
  • area: main
  • in suites: woody
  • size: 712 kB
  • ctags: 156
  • sloc: perl: 3,068; sh: 498; makefile: 99
file content (185 lines) | stat: -rw-r--r-- 5,723 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
#!/bin/sh -e
#
# Sendmail rc script for Debian (/etc/init.d/sendmail)
#
# Copyright (c) 2001-2001, Richard Nelson <cowboy@debian.org>.
# Time-stamp: <2001/08/20 10:00:00 cowboy>
#
# Notes (to all):
#       * This is no longer a conffile - don't edit this... instead
#         edit /etc/mail/sendmail.conf
#
# Notes (to self):
#       *
#
set -e;
PATH=/bin:/usr/bin:/sbin:/usr/sbin;

#------------------------------------------------------------------------------
# Autoconf variables - in a form suitable for sh, perl
# Generated automatically from autoconf.sh.in by configure.
#------------------------------------------------------------------------------
# Variables for, and by, Autoconf (Don't touch these! edit config step)
PACKAGE_NAME="Sendmail";
PACKAGE_VERSION="8.12.1";
prefix="/usr";
exec_prefix="/usr";
bindir="/usr/bin";
sbindir="/usr/sbin";
libexecdir="/usr/lib/sm.bin";
datadir="/usr/share";
sysconfdir="/etc";
sharedstatedir="/usr/com";
localstatedir="/var";
libdir="/usr/lib";
includedir="/usr/include";
infodir="/usr/share/info";
mandir="/usr/share/man";
docdir="/usr/share/doc";
srcdir="/local/home/src/sendmail/sendmail-8.12.1/..";

# All the real work is done by helper functions defined herein
if [ ! -x ${datadir}/sendmail/sm_helper.sh ]; then
        exit 0;
        fi;
. ${datadir}/sendmail/sm_helper.sh;

# Some requisite initialization
Get_Parameters;

# Ok, why are we here...
case "$1" in

        #----------------------------------------------------------------------
        # Debian required/optional targets:
        #----------------------------------------------------------------------
        start)
                echo -n "Starting Mail Transport Agent: "
                start_sendmail;
                echo "$NAME."
                ;;

        stop)
                echo -n "Stopping Mail Transport Agent: "
                stop_sendmail;
                echo "$NAME."
                ;;

        restart)
                echo -n "Restarting Transport Agent...";
                # reload is equivalent (but faster) than stop/start !
                reload_sendmail;
                echo "$NAME.";
                ;;

        restart-if-running)
                if ! is_running mta && ! is_running msp; then
                        echo "Mail Transport Agent: $NAME is not running";
                else
                        $0 restart;
                        fi;
                ;;

        reload|force-reload)
                echo -n "Reloading Mail Transport Agent configuration...";
                reload_sendmail;
        echo "$NAME.";
                ;;

        #----------------------------------------------------------------------
        # Local targets (sendmail commands/aliases) for MSP/MTA split support
        # These targets will pass along any provided parameters
        #----------------------------------------------------------------------
        newaliases)
                shift;
                newaliases $*;
                ;;

        hoststat)
                shift;
                hoststat $*;
                ;;

        purgestat)
                shift;
                purgestat $*;
                ;;

        mailstats)
                shift;
                mailstats $*;
                ;;

        mailq)
                shift;
                mailq $*;
                ;;

        runq)
                shift;
                runq $*;
                ;;

        #----------------------------------------------------------------------
        # Local targets for extended support/debugging
        #----------------------------------------------------------------------
        status)
                shift;
                status $*;
                ;;

        debug)
                #
                # If not running, can't debug
                if is_running msp; then
                        echo -n "Dumping MSP state...";
                        $SIGNAL_MSP_CMD --signal USR1;
                        echo "done.";
                        fi;
                if is_running mta; then
                        echo -n "Dumping MTA state...";
                        $SIGNAL_MTA_CMD --signal USR1;
                        echo "done.";
                        fi;
                ;;

        clean|clean_que*|clean-que*)
                #
                # If running, don't clean the queues...
                if is_running mta; then
                        echo "MTA is running, queue cleaning ill advised...";
                else
                        echo -n "Cleaning up the queues...";
                        clean_queues;
                        echo "done.";
                        fi;
                ;;


        #----------------------------------------------------------------------
        # Local targets for cronjob support
        #----------------------------------------------------------------------
        cron-msp)
                cron_msp;
                ;;

        cron-mta)
                cron_mta;
                ;;

        #----------------------------------------------------------------------
        # Default target - bitch and moan
        #----------------------------------------------------------------------
        *)
                echo "Invalid command <$1>";
                echo "Usage: $0 <command>";
                echo "  Where <command> is one of the following";
                echo "    start|stop|restart|restart-if-running";
                echo "    reload|force-reload";
                echo "    newaliases|hoststat|purgestat|mailstats|mailq|runq";
                echo "    status|debug|clean";
                exit 1;
                ;;
        esac;

exit 0;