[plug] howto logging result to a log file
Craig Foster
fostware at iinet.net.au
Wed Aug 27 07:01:27 WST 2003
Denis Brown wrote:
> On Tue, 26 Aug 2003, Jon Miller wrote:
>
<snip>
>> echo `date` mmpf >> /var/log/pstfxst.log
>> Does this seem correct?
>>
> Hello, Jon.
>
> Well, to create the file in the first place, perhaps "touch"?
> Certainly the >> seems tolerant of the initial absence of a file
> though.
>
> In bash at least, echo 'date' just echoes the literal word 'date'.
> To get the true date you would need echo $(date) or if you want to
> get fancy you can add formatting such as echo $(date +%Y%m%d) to get
> just the Year, Month and Day a la 20030827
Actually the `(usually under ~) in bash execs the program in situ.
So this would run echo date's results and the word mmpf
Better to use multilog, which (when used in conjunction with daemontools)
automatically logs all output, and can restart daemons when they fail.
Look at http://cr.yp.to/daemontools.html for more info. (From the guy who
wrote qmail) Yeah, it's a big hammer, but it takes care of a lot of
housekeeping.
<snip>
>
> HTH,
> Denis
>
> PS any suggestions for a good reference text on shell scripting?
> Sure I can Google but a recommendation from someone in our community
> who's used the book(s) would be "gold".
At the risk of sounding like a "me too", I wouldn't mind knowing either :)
Craig F.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3925 bytes
Desc: not available
URL: <http://lists.plug.org.au/pipermail/plug/attachments/20030827/deb8b8b3/attachment.bin>
More information about the plug
mailing list