Re: Emulate(?) the crontab

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

 



Le mardi 09 janvier 2007 à 19:33 +0000, Mário Gamito a écrit :
> Hi,
[...]
> The agregator software must run a one line command every 15 minutes to 
> rebuild the index.html of the site.
If you have a remote shell access with a "root" account, you do can
edit the system crontab. Edit file /etc/crontab and put a line like the
following, with the hope this is not a standard old cron but a Vixie
cron thus allowing 15 minutes:

*/15 *  * * *   root    /ACCESS/TO/planet.py /ACCESS/TO/geek/fancy/config.ini

if you have only a webmaster account, edit your own crontab with
command "crontab -e" and do not put the "root" field.

> The command is
> #planet.py geek/fancy/config.ini
> 
[...]
> I wonder if there could be written a script (bash, perl, python), that 
> *without crontab* could run the command I need.

A nice choice is a "while" loop and a "sleep" inside it. for instance:
edit file looplanet.sh:

#!/bin/sh
SECONDS=`expr 60 \* 15`
while true
do
    /ACCESS/TO/planet.py /ACCESS/TO/geek/fancy/config.ini
    sleep $SECONDS
done
#end of file

then "chmod" it to make it read+executable:
bash [~/bin] # chmod 755 looplanet.sh
then launch it with "nohup" or "setsid" and ensure it can run
once you are logged out.
bash [~/bin] # nohup ./looplanet.sh &
[...nohup telling where it stores output]
bash [~/bin] # exit

> Any help would be appreciated.
Hope the above helped. There is no more way regarding given infos.
> 
> Warm Regards,
> Mário Gamito
> -
> To unsubscribe from this list: send the line "unsubscribe linux-admin" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Newbie]     [Audio]     [Hams]     [Kernel Newbies]     [Util Linux NG]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Device Drivers]     [Samba]     [Video 4 Linux]     [Git]     [Fedora Users]

  Powered by Linux