[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [leafnode-list] Re: Cron Job and System Load



Matthias Andree said:
> Mike Vanecek schrieb am Tuesday, den 18. February 2003:
>
>> I would be interested in seeing a copy of the cron job. That sounds
>> like a useful thing to do.
>
> It's probably just something like using this script, chmod'ing it to
> mode 0755 and running it from cron:
>
> #! /bin/sh
> if [ -n "`find /var/spool/news/out.going/ -type f -print`" ]
> then
>         fetchnews -Pv
> fi

Mine was not as pretty as is yours:

#! /bin/sh
# chk_leaf_out - check for outgoing posts 8 times a day

# Exit if a command yields a non-zero result
set -e

leafnode=`ls -A /var/spool/news/out.going | wc -l`
# echo $leafnode

if [[ $leafnode  -ge 0 ]] ; then
    fetchnews -P
else
    exit 0
fi

I then did a crontab -u news -e  to set it up:

# fetchnews 8 times a day
12 0-23/3 * * *  /usr/sbin/fetchnews

# fetchnews post every 5 minutes
0-59/5 * * * *  /var/spool/news/chk_leaf_out

Hope this all works.

-- 
leafnode-list@xxxxxxxxxxxxxxxxxxxxxxxxxxxx -- mailing list for leafnode
To unsubscribe, send mail with "unsubscribe" in the subject to the list