Archive - Advanced dequeueing of mail from Autotur...
Archive - Advanced dequeueing of mail from Autoturn
This article is archived, the autoturn functionality is no longer available.
I had a recurring problem with dequeueing mail from the autoturn server. Initially, I had a cron job which periodically issued: "finger firstname.lastname@example.org" Now, most of the time, this worked absolutely fine. However, sometimes the command simply seemed to hang indefinitely. Every morning, I had to run a 'killall -9 finger' to get rid of the excess processes, which isn't very elegant. So, I decided to expand my simplistic mail dequeueing command with a bash script to do the same, except it will now wait for a specified amount of time, then kill the finger process if it's still hanging around. For anyone else having similar problems dequeueing mail using autoturn, here is the script. Feel free to use as you require.
#!/bin/bash # Author: Barry Zubel # You are free to use this script any way you wish. TIMEOUT=60 FINGER=/usr/bin/finger DESTemail@example.com # Run the finger command. $FINGER $DEST & # grab the PID of the finger command pid=$! # sleep for a specified amount of time sleep $TIMEOUT # kill the finger command, if it's still running. Redirect all output # to /dev/null kill -s SIGTERM $pid > /dev/null 2>&1