the reason why I don't want ot use cron and at seems to make people thinking. 
Understandable. Well I am the only root administrator of my machines so cron 
would be my last resort. Also I wanted to know if this is possible. I always 
wonder how cron works without having an infinite loop and yet don't take much 
of the CPU.

As you explain, this is possible. 

Thanks for all the inputs about cron.

On Wednesday 21 July 2004 10:18, Bopolissimus X Platypus wrote:
> On Wednesday 21 July 2004 09:25, alben benavente alteza wrote:
> > As much as possible I don't want to use cron. I want my script
> > to be self sufficient. I am also interested if such thing is possible.
>
> everyone has suggested that you use cron or at if you can.
> therefore, you should use cron or at if you can.  the only valid reasons
> i can see for not using cron are (1) hiding the fact that there's a
> daemon from the system administrator (well, making it a little harder
> for her to notice) and (2) you're not the system administrator and
> you can't get the system administrator to set it up for you.
>
> siempre, there's also (3) i just want to see if it can be done without
> using cron, but then if your motivation is pure learning, i'd say
> it'd be more interesting, and you'd learn more, if you were to
> google and read unix documentation by yourself, maybe
> discussing with people you work with.  asking a group like this
> leads to finding the solution, but not the kind of deep learning
> that comes from reading and trying out many solutions and
> inventing solutions, some of them silly.
>
> > > > Now my new problem arise. How do I run multiple task in a
> > > > single script  with different time interval?
>
> the simplest way is to just run them in different scripts.  or the
> same script, but with command line parameters (task and
> interval).  then just run them all in the background.  so one script
> sleeps for 10 minutes, the other script sleeps for 17 minutes, or
> whatever interval you need.  since you're using sleep, you can
> even do better than the 1 minute resolution of cron, so you can
> sleep for 30 seconds, etc.
>
> if you *must* run them in a single script (there's no obvious reason
> why you'd have to do this, but let's say that you just have to, or you
> just want to make things harder for yourself), then you could have
> a while loop that sleeps per second (or per lowest common factor
> of the different intervals, e.g., if the intervals are 10, 20, 25 45 60
> minutes, then you sleep per 5 minutes) and then if conditions for
> each of the intervals you're interested in.  there was a thread
> recently about how to do math inside the shell, look at that.
>
> note, it's just programming.  if you know how to program, you can
> hack out a solution.  now, there might be better solutions than this
> loop for lowest common factor and sleep for multiples of that factor,
> but this one works, and you might be able to figure out some of
> the other solutions too.
>
> tiger

-- 
Alben Benavente Alteza 
Information Systems Security and Internet Services Administration
Information Systems Department / Philippine Airlines 

--
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

Reply via email to