Emulate(?) the crontab
Hi,
I have this blog agregator in http://www.planetgeek.org
It is hosted, i. e., i'm paying for the hosting.
The agregator software must run a one line command every 15 minutes to rebuild the index.html of the site.
The command is
#planet.py geek/fancy/config.ini
It represents no stress at all for the server.
Meanwhile, i've asked the support to insert the line in the crontab.
Now, they want me to pay 29 euros a month for that line in the crontab. It's outrageous. It's twice than the hosting cost itself.
I wonder if there could be written a script (bash, perl, python), that *without crontab* could run the command I need.
Any help would be appreciated.
Warm Regards,
Mário Gamito
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
It bounced back..hence sending again
Quoted 56 lines · Atishay Kumar
Yes Mario, I think you can do it.
All you need to write a shell script which will wait run this command in a loop. The should contain logic to wait for 15 mins for every iteration.
example
while true
do
command
sleep 37 # Put whatever time you want. It should 15*60 for 15 mins.
doneI hope that helps
cheers/atishay
Quoted 22 lines · Mário Gamito
Hi,
I have this blog agregator in http://www.planetgeek.org
It is hosted, i. e., i'm paying for the hosting.
The agregator software must run a one line command every 15 minutes to rebuild the index.html of the site.
The command is
#planet.py geek/fancy/config.iniIt represents no stress at all for the server.
Meanwhile, i've asked the support to insert the line in the crontab.
Now, they want me to pay 29 euros a month for that line in the crontab. It's outrageous. It's twice than the hosting cost itself.
I wonder if there could be written a script (bash, perl, python), that *without crontab* could run the command I need.
Quoted 9 lines
Any help would be appreciated.
Warm Regards,
Mário Gamito
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html--
Atishay Kumar
Signature · 5 lines
Atishay Kumar - To unsubscribe from this list: send the line "unsubscribe linux-admin" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Mario
Quoted 10 lines · Mário Gamito
Hi,
I have this blog agregator in http://www.planetgeek.org
The agregator software must run a one line command every 15 minutes to rebuild the index.html of the site.
The command is
#planet.py geek/fancy/config.iniI wonder if there could be written a script (bash, perl, python), that *without crontab* could run the command I need.
Yes and no. You could - depending on the hosting solution - write a script that runs in an endless loop and does a sleep() and set it as a background process. The big issue there is that a server reboot will kill that process. There are sneaky ways around that, like for example checking if the process is running - each time a user hits your page, a script launches to see if the endless job is running. If not - restart it.
Alternatively if you have shell access you can run a timed process on a different machine which for example uses SSH to hop on to the host, runs the process and backs off. If you have a server or 24/7 machine at home for example that would work just fine.
Either solution would be reasonably feasible.
Jen
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 1 line · Mário Gamito
Hi,
[...]
Quoted 2 lines
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.
Quoted 3 lines
The command is
#planet.py geek/fancy/config.ini
[...]
Quoted 2 lines
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
Quoted 1 line
Any help would be appreciated.
Hope the above helped. There is no more way regarding given infos.
Quoted 7 lines
Warm Regards,
Mário Gamito
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in the body of a message to [email protected]
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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
... ciao:
: on "1-9-2007" "Mário Gamito" writ:
: blog agregator in http://www.planetgeek.org
: agregator must run every 15 minutes
all that suggests, you have execute permission. if you can run it
once, then you can 'wrap it in a script' that handles the invocation and timing issues.
finally, the webpage could check to see if the script running, and if
not, invoke it.
all that assumes you don't have a local cron facility ...
Signature · 7 lines
... i'm a man, but i can change,
if i have to , i guess ...
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.htmlHi,
Quoted 8 lines · Mário Gamito
The agregator software must run a one line command every 15 minutes to rebuild the index.html of the site.
The command is
#planet.py geek/fancy/config.iniIt represents no stress at all for the server.
Quoted 7 lines
Meanwhile, i've asked the support to insert the line in the crontab.
Now, they want me to pay 29 euros a month for that line in the crontab. It's outrageous. It's twice than the hosting cost itself.
I wonder if there could be written a script (bash, perl, python), that *without crontab* could run the command I need.
Another option is to use a web based cron service. Search on google for webcron. I haven't used any of them so I can't comment on how well they work.
Cheers
Adam
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html