Re: logging output of a cronjob
Daryl Tester <[email protected]> Sat, 05 Apr 2008 11:33:38 +1030
| Newsgroups | gmane.comp.djb.syslog |
|---|---|
| Message-ID | <[email protected]> |
(Note: reply-to set to evade the autoresponders). (Note note: my opinions only; if you don't like 'em, ignore 'em). Otavio Exel wrote: > I've never heard of someone using multilog this way; > any pitfalls that I should be aware of? Yep, don't run more than one at once (as you already noted). I do the same thing for running postgresql vacuum outputs at a verbose level, which produces lots of output of which I'm mostly not interested in until something goes wrong. > is there a recommended way to prevent 2+ instances of multilog from > using the same dir? I use setlock (also daemontools? It's djbware anyway) to ensure only once instance of the script is running, either explicitly or implicitly through a wrapper script. > is there a way to force multilog to wait for /var/log/xyw/lock instead > of exiting with code 111? Should be done before multilog runs otherwise other processes that make up the pipeline will start and then be aborted (e.g. the postgres vacuum process mentioned above will be started then terminated). Best to ensure that you *have* your resources (e.g. lock) before attempting the work. You can also run it as a supervised job with the down flag touched - just svc -o to start it and allow it to run until completion. This is OK if you don't mind cluttering up your process table with supervise entries (I initially did this, then went the first route because of this). > someone suggested (many years ago) supervising a script like that... > #!/bin/sh > test -p my-pipe || mkfifo my-pipe > exec cat my-pipe > ...and sending to-be-logged-data to my-pipe; seems to me to be a good > idea (although a bit too complex); > > any comments? That may not stop your script from running concurrently, which I'm not sure is what you're wanting to do (I don't remember if a named fifo can be opened exclusively for writing - a quick test here says "no"). -- Regards, Daryl Tester "We are sexy, sexy Von Neumann machines." -- http://www.xkcd.org/387/