On Mon, Jan 28, 2008 at 03:22:41PM +0100, Dan H. wrote:
> for a home computer that gets shutdown daily, I'd like to implement a
> function which:
> 
> 1. makes sure that all pending outgoing mails are sent off. 

Here's what I've come up with. Anything not to like?

#!/bin/sh

# install with this as root:
# # update-rc.d flushmail defaults 21 19
# assuming that exim has sequence number 20 on startup and shutdown.


### BEGIN INIT INFO
# Provides:          flushmail
# Required-Start:
# Required-Stop:     exim4 mail-transport-agent
# Should-Start:
# Default-Start:
# Default-Stop:      0 1 6
# Short-Description: Flush mail queue
### END INIT INFO

set -e

QUEUERUNNER="/usr/sbin/runq"

if [ ! -x $QUEUERUNNER ] ; then exit 1 ; fi

case "$1" in
  start)
  echo "Not flushing on startup"
  ;;
  
  restart|stop)
  echo -n "Flushing mail queue..."
  $QUEUERUNNER
  echo "done."
  ;;
esac

exit 0

Attachment: signature.asc
Description: Digital signature

Reply via email to