Printing to a file

dec

Verified User
Joined
May 12, 2004
Messages
163
Hi

How to print the results of a script like logwatch to a file in linux?

Thanks

Dec
 
hello

PHP:
pico -w /etc/log.d/logwatch.conf

find the line

PHP:
# if set, the results will be saved in <filename> instead of mailed
# or displayed.
#Save = /tmp/logwatch

remove the # in front of Save and put in your path

such as

PHP:
Save = /tmp/logwatch

all done, but you will not get an e-mail anymore.

once logwatch is run from crond later that day you should be able to

PHP:
pico - w /tmp/logwatch

and see your results.
 
Thanks Vandal..! ;)

I actually figured it out o couple minutes ago :D

But in general.. What would be the command to print results of a batch to a file?

Regards

Dec
 
well i'm not totally sure what you mean :)

but this might be helpful

command > /tmp/output.txt

or to append (add to the end)

command >> /tmp/output.txt

for example



PHP:
service httpd restart > /tmp/output.txt

then

PHP:
cat /tmp/output.txt

if this isn't what you mean let me know :)
 
vandal said:
well i'm not totally sure what you mean :)

but this might be helpful

command > /tmp/output.txt

or to append (add to the end)

command >> /tmp/output.txt

for example



PHP:
service httpd restart > /tmp/output.txt

then

PHP:
cat /tmp/output.txt

if this isn't what you mean let me know :)


Sorry for the confusion..

So basically you are saying that with this:

command > /tmp/output.txt

I will get the results of the command in the file output.txt ?

Dec
 
you bet,

then use cat to print the newly created file to screen and you will see the results of that command.

cat /tmp/output.txt
 
WOW man!

That's what i was looking for! :D

Thanks a lot

Dec
 
Back
Top