2 # Depends: lockfile-progs, ssh
6 echo "Usage: $0 hostname" 2>&1
10 DIR="$HOME/tmp/.bsmtp"
16 # TODO: Note that this scheme may currently lose mail if the local disk
17 # fills up! This is obviously very bad. Fix this.
19 # By default, lockfile-create gives up after three minutes, so don't cron
20 # this any more frequently than that without supplying a --retry argument.
21 lockfile-create "$HOST"
22 lockfile-touch "$HOST" &
24 trap 'kill "$TOUCH"; lockfile-remove "$HOST"' EXIT ERR HUP INT QUIT TERM
26 ssh -2 -i "$HOME/.ssh/id-bsmtp-$HOST" -C "$HOST" bsmtp-pull-server > "$HOST"
27 [ -s "$HOST" ] || exit 0
28 /usr/sbin/sendmail -bS < "$HOST"