Emulate(?) the crontab

Emulate(?) the crontab

am 09.01.2007 20:33:11 von 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=20
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=20
*without crontab* could run the command I need.

Any help would be appreciated.

Warm Regards,
M=E1rio Gamito
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" =
in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: Emulate(?) the crontab

am 09.01.2007 20:47:03 von Atishay Kumar

It bounced back..hence sending again

On 1/10/07, Atishay Kumar wrote:
> 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 iter=
ation.
>
> example
>
> while true
> do
> command
> sleep 37 # Put whatever time you want. It should 15*60 =
for 15 mins.
> done
>
>
> I hope that helps
>
> cheers/atishay
>
>
>
> On 1/10/07, M=E1rio Gamito wrote:
> > 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 cron=
tab.
> > It's outrageous. It's twice than the hosting cost itself.
> >
> > I wonder if there could be written a script (bash, perl, python), t=
hat
> > *without crontab* could run the command I need.
> >
> > Any help would be appreciated.
> >
> > Warm Regards,
> > M=E1rio Gamito
> > -
> > To unsubscribe from this list: send the line "unsubscribe linux-adm=
in" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
> >
>
>
>
> --
> Atishay Kumar



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

Re: Emulate(?) the crontab

am 09.01.2007 21:47:13 von Jens Knoell

Hi Mario

On 01/09/2007 12:33 PM, M=E1rio Gamito wrote:
> Hi,
>
> I have this blog agregator in http://www.planetgeek.org
>
> The agregator software must run a one line command every 15 minutes t=
o=20
> rebuild the index.html of the site.
>
> The command is
> #planet.py geek/fancy/config.ini
>
> I wonder if there could be written a script (bash, perl, python), tha=
t=20
> *without crontab* could run the command I need.
Yes and no. You could - depending on the hosting solution - write a=20
script that runs in an endless loop and does a sleep() and set it as a=20
background process. The big issue there is that a server reboot will=20
kill that process. There are sneaky ways around that, like for example=20
checking if the process is running - each time a user hits your page, a=
=20
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=
=20
different machine which for example uses SSH to hop on to the host, run=
s=20
the process and backs off. If you have a server or 24/7 machine at home=
=20
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 majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: Emulate(?) the crontab

am 09.01.2007 22:34:05 von brouits

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 t=
o=20
> 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/conf=
ig.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
>=20
[...]
> I wonder if there could be written a script (bash, perl, python), tha=
t=20
> *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=3D`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.
>=20
> Warm Regards,
> Mário Gamito
> -
> To unsubscribe from this list: send the line "unsubscribe linux-admin=
" in
> the body of a message to majordomo@vger.kernel.org
> 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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: Emulate(?) the crontab

am 10.01.2007 01:27:48 von terry white

.. ciao:

: on "1-9-2007" "M=E1rio 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 an=
d
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 ...


--=20
.. 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 majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: Emulate(?) the crontab

am 10.01.2007 10:41:54 von adam.bowen

Hi,

M=E1rio Gamito wrote:
> The agregator software must run a one line command every 15 minutes t=
o
> rebuild the index.html of the site.
>=20
> The command is
> #planet.py geek/fancy/config.ini
>=20
> It represents no stress at all for the server.
>=20
> Meanwhile, i've asked the support to insert the line in the crontab.
>=20
> Now, they want me to pay 29 euros a month for that line in the cronta=
b.
> It's outrageous. It's twice than the hosting cost itself.
>=20
> I wonder if there could be written a script (bash, perl, python), tha=
t
> *without crontab* could run the command I need.

Another option is to use a web based cron service. Search on google fo=
r
webcron. I haven't used any of them so I can't comment on how well the=
y
work.

Cheers

Adam

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

Re: Emulate(?) the crontab

am 10.01.2007 12:05:55 von root

Hello,

I guess you could run something like this in the background..

#!/bin/bash
until false
do
planet.py geek/fancy/config.ini
sleep 900
done
exit 0

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

Re: Emulate(?) the crontab

am 10.01.2007 12:16:18 von Jean

Put the command in /etc/inittab:


ap:3:respawn:/usr/local/bin/my_script.sh
or
ap:3:respawn:/bin/su - someuser -c /usr/local/bin/my_script.sh



> Hello,

>
> I guess you could run something like this in the background..
>
> #!/bin/bash
> until false
> do
> planet.py geek/fancy/config.ini
> sleep 900
> done
> exit 0
>
> --Adrian
> -
> To unsubscribe from this list: send the line "unsubscribe linux-admin"
in the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>


--
Jean Michel Bouchara
Completo Tecnologia Ltda. - http://www.completo.com.br/
Fone / Fax: (0xx11) 3081-3644
--
Visite o site http://www.escrevinhadora.com.br/


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

RE: Emulate(?) the crontab

am 10.01.2007 13:09:42 von root

I seriously doubt that would work as our guy here is not root, thus the
question asked.

# ls -l /etc/inittab
-rw-r--r-- 1 root root 2464 2002-05-07 07:45 /etc/inittab


--Adrian



-----Original Message-----
From: linux-admin-owner@vger.kernel.org
[mailto:linux-admin-owner@vger.kernel.org] On Behalf Of Jean M. Bouchara
Sent: Wednesday, January 10, 2007 13:16 PM
To: linux-admin@vger.kernel.org
Subject: Re: Emulate(?) the crontab


Put the command in /etc/inittab:


ap:3:respawn:/usr/local/bin/my_script.sh
or
ap:3:respawn:/bin/su - someuser -c /usr/local/bin/my_script.sh



> Hello,

>
> I guess you could run something like this in the background..
>
> #!/bin/bash
> until false
> do
> planet.py geek/fancy/config.ini
> sleep 900
> done
> exit 0
>
> --Adrian
> -
> To unsubscribe from this list: send the line "unsubscribe linux-admin"
in the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>


--
Jean Michel Bouchara
Completo Tecnologia Ltda. - http://www.completo.com.br/
Fone / Fax: (0xx11) 3081-3644
--
Visite o site http://www.escrevinhadora.com.br/


-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: Emulate(?) the crontab

am 10.01.2007 13:43:28 von adamb

Buy an interstellar-chameleon-monkey, send him back in time to 1970,
where he can impersonate Dennis Richie and insert some code into the C
compiler that will propagate down through time into the latest compilers
used to build Linux and add some code allowing you to edit the inittab file.

Oh, bugger. I forgot. You can't buy interstellar-chameleon-monkeys yet.
Sorry. Scratch that idea.

Adam

Adrian C. wrote:
> I seriously doubt that would work as our guy here is not root, thus the
> question asked.
>
> # ls -l /etc/inittab
> -rw-r--r-- 1 root root 2464 2002-05-07 07:45 /etc/inittab
>
>
> --Adrian
>
>
>
> -----Original Message-----
> From: linux-admin-owner@vger.kernel.org
> [mailto:linux-admin-owner@vger.kernel.org] On Behalf Of Jean M. Bouchara
> Sent: Wednesday, January 10, 2007 13:16 PM
> To: linux-admin@vger.kernel.org
> Subject: Re: Emulate(?) the crontab
>
>
> Put the command in /etc/inittab:
>
>
> ap:3:respawn:/usr/local/bin/my_script.sh
> or
> ap:3:respawn:/bin/su - someuser -c /usr/local/bin/my_script.sh
>
>
>
>> Hello,
>
>> I guess you could run something like this in the background..
>>
>> #!/bin/bash
>> until false
>> do
>> planet.py geek/fancy/config.ini
>> sleep 900
>> done
>> exit 0
>>
>> --Adrian
>> -
>> To unsubscribe from this list: send the line "unsubscribe linux-admin"
> in the body of a message to majordomo@vger.kernel.org
>> 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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html