Douglas Muth on 22 Sep 2009 15:27:22 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] correct way to do this in bash


On Tue, Sep 22, 2009 at 6:19 PM, Mag Gam <magawake@gmail.com> wrote:
> Currently for my research I have a process that writes 24 hours and 5
> days a week.  Its writes to standard out and there is standard error.
> There is a lot of data, close to 300Gb a day therefore I can't lose a
> minute of outage.
>
> I am capturing daily reports and cutoff is at 8:00AM.
>
> process > /phys/data/20090922/20090922.crac.out
> 2>/phys/data/20090922/20090922.crac.err.out
>
> At 7:59AM I kill the process using cron and restart the process at
> 8:00AM everyday for 5 days using cron. I lose 1 min of simulation data
> :-(.
>
> Is there a clever way to have my process run or restart at 8:00AM
> without cron and no interruption? Or is this the preferred way?

If you need separate logfiles, you could try the multilog program,
which automatically does log rotation:

http://cr.yp.to/daemontools/multilog.html

Cutting off logfiles at 8 AM still may be a challenge, though.

You could also try rolling your own solution with named pipes, and
killing/restarting the process that reads data from the pipes:

http://www.linuxjournal.com/article/2156

...this may cause blocking issues on the program writing to the pipes,
however.  I don't have enough experienced with named pipes to say for
certain.

-- Doug
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug