On Tue, 31 Jul 2001, Mads Rasmussen wrote:

>
>
> I would like to log the uptime of our systems, just I cannot see into the
> future to expect when a system crashes so an aproach that logs, like 1 time
> per hour should do it.
>
> I guess you could run a crontab script that just cat's the uptime output into
> /var/log/uptime
>
> This however will be overwritten when the system comes back up, so I thought
> it would be better to log in two files a live one and a backup one.
>
> Like
>
> uptime > uptime.running
> uptime > uptime
>
> This just make it worse, what if the system breaks down twice? Then the first
> logged uptime will vanish.
>
> What I guess I am looking for is when the uptime gets activated, if I could
> just before uptime gets called for the first time, do a logrotate, then I
> would be safe.
>
> It wouldn't be enough to insert a logrotating script in rc.local would it?

logrotate seems to me like an overkiil. Why mess with multiple files? What
you need is simply a small script that will run something like:

  cat uptime.current >> uptime.permanent

Also, rc.local may be too late. You need to run this before cron is
started. You should probably write an init.do script and add it to the
appropriate runlevels before cron is started.

>
> Any other approaches?

I vaguely recall that there's a package called "downtime" that does
exactly this, but I'm not sure. Anyway, I'm sure that there's already at
least one package that does this...

-- 
Tzafrir Cohen
mailto:[EMAIL PROTECTED]
http://www.technion.ac.il/~tzafrir


Reply via email to