#!/bin/sh
case "$1" in
start)
sendmail -q
date +%d.%m.%Y\ %H:%M:%S\ fetchmail\ started >> /var/log/fetchmail.log
fetchmail -d 1 -L /var/log/fetchmail.log &
tail -f /var/log/fetchmail.log
;;
stop)
fetchmail -q
date +%d.%m.%Y\ %H:%M:%S\ fetchmail\ stoped >> /var/log/fetchmail.log
;;
fetch)
date +%d.%m.%Y\ %H:%M:%S\ fetchmail\ started >> /var/log/fetchmail.log
fetchmail -d 1 -L /var/log/fetchmail.log &
tail -f /var/log/fetchmail.log
;;
status)
tail -f /var/log/fetchmail.log
;;
got)
/usr/local/gotmail/gotmail
;;
goth)
/usr/local/gotmail/gotmail html
;;
send)
/sendmail -q
;;
clear)
fetchmail -q
rm /var/log/fetchmail.log
;;
-v)
echo 'getmail version: 0.0.1'
;;
*)
echo
echo 'Usage: getmail option'
echo
echo 'options:'
echo ' clear - stops fetchmail and kills the logfile'
echo ' fetch - starts fetchmail'
echo ' got - starts gotmail'
echo ' goth - starts gotmail html'
echo ' send - sends all mail from the mailqueue'
echo ' status - tails the logfile'
echo ' start - starts fetchmail and tails the logfile'
echo ' stop - stops fetchmail'
echo ' -v - print the version number'
echo
esac