Re: logging output of a cronjob

richard lucassen <[email protected]> Fri, 4 Apr 2008 23:59:54 +0200
Newsgroups gmane.comp.djb.syslog
Organization XAQ Systems
Message-ID <[email protected]>
On Fri, 4 Apr 2008 16:27:39 -0300
Otavio Exel <[email protected]> wrote:

> I have an every-minute cronjob that, once in a while, produces a lot
> of output; I'd like to save this output using multilog;
> 
> I decided to do like that:
> 
> 	$ crontab -l | grep xyz
> 	* * * * * setlock xyz/LOCK xyz/main
> 
> 	$ cat xyz/main
> 	#! /bin/sh
> 	if <CERTAIN-CONDITION>
> 	then
> 	  <DO-SOMETHING> | multilog /var/log/xyz
> 	fi
> 
> 	$ _
> 
> I've never heard of someone using multilog this way;
> any pitfalls that I should be aware of?
> 
> is there a recommended way to prevent 2+ instances of multilog from
> using the same dir?
> 
> is there a way to force multilog to wait for /var/log/xyw/lock instead
> of exiting with code 111?
> 
> 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?

Maybe you might have a look at socklog:

http://smarden.org/socklog/

I have replaced syslog with socklog because socklog can be told (just
like multilog) to use a certain amount of diskspace.

R.

-- 
___________________________________________________________________
It is better to remain silent and be thought a fool, than to speak
aloud and remove all doubt.

+------------------------------------------------------------------+
| Richard Lucassen, Utrecht                                        |
| Public key and email address:                                    |
| http://www.lucassen.org/mail-pubkey.html                         |
+------------------------------------------------------------------+