2 # Packets backup directory - You have to CREATE this directory
3 BAK=/var/spool/ifmail/BAK
6 IFLOG=/var/log/ifmail/sysiflog
9 IFLOGARC=/var/log/ifmail/TheLog
14 # how often should i try to call NODE?
17 # delay between outgoing calls in seconds
20 # where to log processing - file or tty/console
23 # Lets backup the log and use a new one
24 if [ -e $IFLOG ]; then
25 echo Rearranging logs...
26 cat $IFLOG >> $IFLOGARC
30 echo "`date \"+%b %d %T\"` ifpoll[$$]: starting" # >> $INFO_TTY
32 # remember me, not to run as root..
34 if [ `whoami` != "$IFCICO_OWNER" ]; then
35 echo "*** run $0 as the owner of ifcico ***"
36 echo "`date \"+%b %d %T\"` ifpoll[$$]: wrong uid (rc 2)" # >> $INFO_TTY
40 # argv[1] is the optional node to call
42 if [ "$1" != "" ]; then
43 if [ "$1" = "-?" ] || [ "$1" = "-h" ]; then
44 echo "usage: ifpoll [<node>]"
51 # let's pack the fido stuff..
55 # loop until ifcico could connect the node or MaxTry is encountered
58 while let 'i <= MaxTry' && let 'errlv != 0'
60 echo -n "`date \"+%b %d %T\"` ifpoll[$$]: $i. try ($NODE) " # >> $INFO_TTY
62 # start ifcico in master mode ..
64 $FIDOPATH/ifcico -r 1 $NODE
66 if [ $errlv != "0" ]; then
67 echo "failed" # >> $INFO_TTY
68 if [ $i != $MaxTry ]; then
73 echo "ok :)" # >> $INFO_TTY
77 # if the poll was fine, unpacking..
79 if [ $errlv = "0" ]; then
80 echo "`date \"+%b %d %T\"` ifpoll[$$]: unpacking.. " # >> $INFO_TTY
81 cp -f /var/spool/ifmail/inb/*.* $BAK
83 # add here some additional lines for processing tic files or
84 # incoming file-lists or simular..
86 # write me a mail about the failed poll
87 tail --lines=20 $IFLOG | elm -s "ifpoll: failed" $IFCICO_SYSOP >/dev/null
90 echo "`date \"+%b %d %T\"` ifpoll[$$]: finished (rc $errlv)" # >> $INFO_TTY
92 # Collect some infos...
94 echo "*** Outgoing File Transfer Stats: ***"
96 echo "*** Incoming File Transfer Stats: ***"
100 echo "---->> New mail: <<-----"
102 echo "---->> Personal mail: <<-----"
103 grep "mail from" $IFLOG
106 # return the errorlevel of ifcico