Re: [SLE] Replacing Hard Drive
On Thu, Apr 04, 2002 at 03:10:01PM +0200, php@nickselby.com wrote:
Hmmm. When I did cat /dev/null it started scrolling for about a week (actually about two hours) but I got the impression it was COPYING the file to /dev/null not moving the cvontents there. Was that just plain wrong of me?
You remembered the redirection arrow? cat /dev/null > /var/log/messages ^ | This is important what it's doing is copying /dev/null (which is a zero-length file) to overwrite /var/log/messages. If you miss out the arrow, then you're just asking cat to display the contents of /dev/null and /var/log/messages on the screen. I'm not surprised that it scrolled for ages. -- David Smith | Tel: +44 (0)1454 462380 Home: +44 (0)1454 616963 STMicroelectronics | Fax: +44 (0)1454 617910 Mobile: +44 (0)7932 642724 1000 Aztec West | TINA: 065 2380 Almondsbury | Work Email: Dave.Smith@st.com BRISTOL, BS32 4SQ | Home Email: David.Smith@ds-electronics.co.uk
DOH! At 02:23 PM 4/4/2002 +0100, you wrote:
On Thu, Apr 04, 2002 at 03:10:01PM +0200, php@nickselby.com wrote:
Hmmm. When I did cat /dev/null it started scrolling for about a week (actually about two hours) but I got the impression it was COPYING the file to /dev/null not moving the cvontents there. Was that just plain wrong of me?
You remembered the redirection arrow?
cat /dev/null > /var/log/messages
^ | This is important
what it's doing is copying /dev/null (which is a zero-length file) to overwrite /var/log/messages.
If you miss out the arrow, then you're just asking cat to display the contents of /dev/null and /var/log/messages on the screen. I'm not surprised that it scrolled for ages.
-- David Smith | Tel: +44 (0)1454 462380 Home: +44 (0)1454 616963 STMicroelectronics | Fax: +44 (0)1454 617910 Mobile: +44 (0)7932 642724 1000 Aztec West | TINA: 065 2380 Almondsbury | Work Email: Dave.Smith@st.com BRISTOL, BS32 4SQ | Home Email: David.Smith@ds-electronics.co.uk
-- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the archives at http://lists.suse.com
It's good to see that mentioned in public. I used to just delete log files and let them get re-created, and sometimes suffered odd glitches that probably originated with that practice... Somebody finally pointed out the method of cat-ing /dev/null over the contents of a live logfile, and I now have slightly fewer odd glitches... slightly... While we're on the topic, a UNIX guru at a previous company had all kinds of scripts and cron jobs that checked file sizes of logfiles and either waved flags at the operator or else regularly copied current contents to a backup location and then zeroed out the contents of live files (much as you suggest). Are there some canned utilities that do this stuff in Linux, or does everybody re-invent the wheel on their own system? /kevin On Thu, 2002-04-04 at 08:23, Dave Smith wrote:
On Thu, Apr 04, 2002 at 03:10:01PM +0200, php@nickselby.com wrote:
Hmmm. When I did cat /dev/null it started scrolling for about a week (actually about two hours) but I got the impression it was COPYING the file to /dev/null not moving the cvontents there. Was that just plain wrong of me?
You remembered the redirection arrow?
cat /dev/null > /var/log/messages
^ | This is important
what it's doing is copying /dev/null (which is a zero-length file) to overwrite /var/log/messages.
If you miss out the arrow, then you're just asking cat to display the contents of /dev/null and /var/log/messages on the screen. I'm not surprised that it scrolled for ages.
While we're on the topic, a UNIX guru at a previous company had all kinds of scripts and cron jobs that checked file sizes of logfiles and either waved flags at the operator or else regularly copied current contents to a backup location and then zeroed out the contents of live files (much as you suggest).
Are there some canned utilities that do this stuff in Linux, or does everybody re-invent the wheel on their own system?
If we are using SuSE we only have to edit /etc/logfiles :-)
participants (4)
-
Dave Smith
-
Kevin McLauchlan
-
Nick Selby
-
Stefan Nilsen