On Tuesday 20 July 2004 14:06, alben benavente alteza wrote:
> Does anyone here done a bask script that will run a program in a certain
> time?
>
> Much like a cron but can't use cron.
>
> A continous for loop or while takes up alot of my CPU.
use cron or at. if you can't do either, maybe you can have another
box use cron or at, and then at the appointed time they either
ssh to your box and start the process or maybe run a web
service (assuming you have httpd running on your box) that
does what you want.
if you *really* want a bash job to do this, well, you could modify
something like this to suit your needs.
#/bin/bash
while true
do
if <the time is right>
then
<do the task>
fi
sleep 1
done
works, i guess. if you don't need seconds resolution, then you could
sleep for more than 1, say 60 or 3600. that's even better.
e.g., you might have a flag file that stores what hour the last task
was done. that way, you can sleep 3600. if the hour is right, and
the flag file hasn't stored this hour yet, you update the flag file
to store this hour, and then perform the task. or forget the flag
file, just do it every hour (3600).
note: sometimes though, your process will die. then you have to
figure out how to notice that it's dead and start it again. if you can
use cron or at, you really should. i've also seen (on freebsd, and
i think on linux too), bash and perl jobs slow down the computer
(almost to the point of unusability) if they've been running too
long (like 5 days). probably a memory leak or some sort of
internal locking.
good luck. ahhh, why can't you use cron?
tiger
--
Gerald Timothy Quimpo [EMAIL PROTECTED] [EMAIL PROTECTED]
http://bopolissimus.sni.ph
Public Key: "gpg --keyserver pgp.mit.edu --recv-keys 672F4C78"
malapit na ang september
The early monastics were distrustful of religious experiences
because of the human ability to make subjective needs and
desires into truths about the universe.
Roberta Bondi, "To Love as God Loves".
--
Philippine Linux Users' Group (PLUG) Mailing List
[EMAIL PROTECTED] (#PLUG @ irc.free.net.ph)
Official Website: http://plug.linux.org.ph
Searchable Archives: http://marc.free.net.ph
.
To leave, go to http://lists.q-linux.com/mailman/listinfo/plug
.
Are you a Linux newbie? To join the newbie list, go to
http://lists.q-linux.com/mailman/listinfo/ph-linux-newbie