TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [TCLUG:3621] Logfile?



I think you should use the  syslog functions in  /usr/include/syslog.h
instead of the re-direction. 

I am not sure if the ">>" maintains a lock/unlock so if there are 2
programs doing a ">>" how the output would appear to be. 

Take a look at "man 3 syslog" for more information. For a script
you can use the "logger" command. The man page should contain
more information.

By using the syslog functions you can avoid a dependancy on 
the location of the log file.

Hope this helps.
sandipan
 

Eric Hillman wrote:
> 
> > -----Original Message-----
> > From: Scott K. Johnson [mailto:skj@visi.com]
> > Sent: Thursday, January 21, 1999 4:04 PM
> > To: TCLUG
> > Subject: [TCLUG:3621] Logfile?
> >
> >
> > Hello all,
> >
> > Is it possible for me to generate entries into a specified logfile?
> >
> > Like a script that executes, and generates entries into /var/adm/messages?
> >
> 
> Well, the obvious answer would be:
> 
> echo "$TEXT" >> /var/log/messages
> 
> The ">>" means "append", as opposed to ">", which overwrites the old file.
> 
> Of course, the script would have to run with root permissions, and you'd
> have to make sure that $TEXT included the date & time.
> 
> Maybe there's a tool that does this automatically, though.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tclug-list-unsubscribe@listserv.real-time.com
> For additional commands, e-mail: tclug-list-help@listserv.real-time.com
> Try our website: http://tclug.real-time.com

--
To reply please remove the "nospam." from my e-mail address above.