LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-21-2005, 11:36 PM   #1
slinky2004
Member
 
Registered: Oct 2004
Posts: 309

Rep: Reputation: 30
using watch to make a log?


is it possible to make watch r edirect it's output into a file to make a kind of makeshift log? so if i wanted to log my cpu temperature i'd do this:
Code:
watch -n.5 cat /proc/acpi/thermal_zone/ATF0/temperature
only somehow get it to save each output to a file so it would look something like this:
Code:
temperature:             53 C
temperature:             53 C
temperature:             53 C
temperature:             53 C
temperature:             51 C
temperature:             54 C
temperature:             53 C
temperature:             53 C
temperature:             57 C
temperature:             55 C
temperature:             55 C
if i could get it to only save the output when the number changes it would be even better.
 
Old 11-21-2005, 11:50 PM   #2
ahedler
Member
 
Registered: Oct 2005
Location: A safe distance from Detroit
Distribution: SuSE 10.0, Knoppix
Posts: 99

Rep: Reputation: 17
After taking a really quick look at the watch man page, I'd think you could just tack on ">> somelog.file" to the end of your command to redirect the output to the file.

Then again, rather than using watch, which I suspect you're running from a command line, possibly in the background, why not try running the cat statement with the redirect in a cron job? Make sure you use ">>" and not ">" so you will be appending to the log file, rather than overwriting it each time it executes.

-Alan
 
Old 11-22-2005, 12:37 PM   #3
slinky2004
Member
 
Registered: Oct 2004
Posts: 309

Original Poster
Rep: Reputation: 30
appending >> on watch didnt work, but i'll try the cron thing. thx
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux Watch vs BSD Watch blueCow *BSD 4 08-16-2009 05:35 PM
how to read log watch ru916b Linux - Security 1 01-05-2005 10:55 PM
which command can make me see the initiation log?? ReiserFS Slackware 6 12-17-2004 10:10 AM
Log errors from 'make' command, how do i? winky Linux - Software 13 08-21-2003 11:31 AM
Strange Log Watch entry magyartoth Linux - General 4 06-07-2002 10:46 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:31 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration