cancel
Showing results for 
Search instead for 
Did you mean: 

Fingering autoturn

zubel
Community Veteran
Posts: 3,793
Thanks: 4
Registered: ‎08-06-2007

Fingering autoturn

I had a recurring problem with dequeueing mail from the autoturn server.
Initially, I had a cron job which periodically issued:
"finger postmaster@autoturn.plus.net"
Now, most of the time, this worked absolutely fine.  However, sometimes the command simply seems 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
DEST=postmaster@autoturn.plus.net
#  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

Hope it's of some use to someone.
B.
1 REPLY 1
SteveA
Pro
Posts: 1,849
Thanks: 106
Fixes: 3
Registered: ‎17-06-2007

Re: Fingering autoturn

neat little script