[Mimedefang] OT: Sendmail Startup Script
Rich West
Rich.West at wesmo.com
Fri Aug 23 15:54:00 EDT 2002
>
>
>>So, I am now running Sendmail, and a queue control process. But what do I
>>do in the stop part?
>>
>>
>
>Ugly, isn't it? The sendmail.org people screwed up; they should start
>a queue runner from the main process and kill it when the main process
>dies, too. My solution is to do this in the "stop" part:
>
>stop() {
> # Stop daemons.
> echo -n $"Shutting down $prog: "
> killproc sendmail
> RETVAL=$?
> echo
> [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/sendmail
> # Arg... kill the queue runner, too.
> killall /usr/sbin/sendmail
> return $RETVAL
>}
>
>Gross. And DON'T TRY THIS on a UNIX system. On some UNIX systems,
>killall kills everything. On Linux, it kills the named process.
>
IMHO, for simplicity, simply call killproc twice. You have two
processes, and killproc kills just one, so call it once for each
process. And the following code will do that. (note that the start
portion of the init script starts the queue-runner AFTER sendmail is
started, so the ordering of the killproc in the snippet below kills them
in the same order)
stop)
# Stop daemons.
echo -n "Shutting down sendmail: "
killproc sendmail
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/sendmail
killproc sendmail
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/sendmail.smmsp
;;
-Rich
More information about the MIMEDefang
mailing list