[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [leafnode-list] Skript starting Fetchnews once per Day
Frank Wagner wrote:
> > Frank Wagner wrote:
> > > I'm looking for a solution to run fetchnews only if 24h has been
> > > past since the last run.
> I want to start fetchnews only if there is a connection to the internet
> anyhow. So I'm looking for a solution to start a skript while
> processing ip-up that starts fetchnews conditionally if it didn't fetch
> in the past 24 hours.
The following might do the trick (untested):
if [ -f $LOCKFILE ]
echo "rm $LOCKFILE" | at "now + 24hours"
This script first looks for a lockfile. If this lockfile exists,
it does not continue. If the lockfile does not exist, it is
created and an at job invoked that will remove the lockfile
after 24 hours (I don't know whether this will work if your
computer is switched off inbetween). Afterwards, fetchnews is
Therefore, the lockfile will always be removed 24 hours after
the last fetchnews run.
Alternatively, you can write the date of your last run into a
file and try to parse it but I think this will be fairly tricky
to do with the shell (of course, you can use Perl instead).
/* Cornelius Krasel, U Wuerzburg, Dept. of Pharmacology, Versbacher Str. 9 */
/* D-97078 Wuerzburg, Germany email: phak004@xxxxxxxxxxxxxxxxxxxxxx SP4 */
/* "Science is the game we play with God to find out what His rules are." */
leafnode-list@xxxxxxxxxxxxxxxxxxxxxxxxxxxx -- mailing list for leafnode
To unsubscribe, send mail with "unsubscribe" in the subject to the list