: # newsstat - get news statistics # Heiner Steven (heiner.steven@odn.de), 10.10.1995 # # called from cron # # Cron does not execute $HOME/.profile, but scripts need # some variables there (i.e. PATH) PATH=$PATH:$HOME/local/bin:$HOME/cmds:/usr/local/bin export PATH : ${PUSER:=heiner.steven@odn.de} PN=`basename $0` : ${USER:=heiner} ArchiveBase=$HOME/.newsstat Date=`date '+19%y.%m.%d'` Tmp=${TMPDIR:=/tmp}/ns$$ trap "rm -f $Tmp >/dev/null 2>&1" 0 trap "exit 2" 1 2 3 15 if [ $# -ne 1 -o X"$1" != X-f ] then echo "$PN: this script normally is not run from the command line, but from cron" >&2 exit 1 fi for Group in comp.unix.shell do [ -d "$ArchiveBase/$Group/posters" ] || mkdir -p "$ArchiveBase/$Group/archive" nice $HOME/cmds/newstop "$Group" > $Tmp if [ -s "$Tmp" ] then mail -s "Top 10 posters to $Group" $USER < $Tmp && mail -s "Top 10 posters to $Group" $PUSER < $Tmp #inews -S -n "$Group" -t "Top 10 posters $Group" < $Tmp cp -p "$Tmp" "$ArchiveBase/$Group/archive/posters.$Date" fi nice $HOME/cmds/newssub "$Group" > $Tmp if [ -s "$Tmp" ] then mail -s "Top 10 subjects in $Group" $USER < $Tmp && mail -s "Top 10 subjects in $Group" $PUSER < $Tmp #inews -S -n "$Group" -t "Top 10 subjects $Group" < $Tmp cp -p "$Tmp" "$ArchiveBase/$Group/archive/subjects.$Date" fi done exit 0