Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 10-02-2011, 01:41 AM   #1
LQ Newbie
Registered: Oct 2011
Location: Canada(don't judge Canadians based on how stupid I am)
Distribution: opensuse 11.3
Posts: 4

Rep: Reputation: Disabled
Lightbulb How to copy, then delete original of whatever log(s) that would help debug crashes...

First off, let's just say I'm writing this way too late at night... So bear with me.

I am very new to linux, although had a bit of experience with Unix back in the 90's. Used to program C... (as my bio says, I know just enough to be dangerous)

anyway, I'm running OpenSuse 11.3 (11.4 would crash immediately after install, that's a problem for another day)

I sometimes suddenly find myself back at the log in screen.

Sometimes I find everything completely frozen.

other times I've had a reboot.

Now, I know there is likely multiple causes, multiple issues etc...

In an attempt to figure out what is wrong,(I suspect RAM failure) I've been reviewing the /var/log/messages file.

This may or may not be the best place to look for the problem... But I would like to have the messages file copied to my home directory with a filename based on date.

currently, I would:

cp /var/log/messages /home/username/messages.snapshot

I would append the date, and a number to represent 1st,2nd etc.

My reasoning, I would later be able to go back and review these, looking for the problem.

So, problem one, the permissions weren't set for username to view them

so before exiting root, I would add:
chown -c messages.snapshot --reference=/home/username/.bashrc

changed ownership of 'messages.snapshot to username:users

My goal was to have in my .bashrc, each time I opened a konsole, which was usually have a crash to check what happened, I wanted it to do all that above...

copy the messages file
change ownership of new file
delete original(so each time I copied the file I was only looking at data since the last copy)

so as I worked toward this goal, I, in my utter brilliance, put in my username/.bashrc file,


so each time I opened a console it would prompt me for root's password

I then edited /root/.bashrc:
cp /var/log/messages /home/username/messages.snapshot
chown -c messages.snapshot --reference=/home/username/.bashrc

.... wait for it.... .... then I added ....
to my /root/.bashrc

took me a while to figure out a way out of that one. Only way to edit roots .bashrc was to have su power, but to get that, .bashrc would run, and force me back to standard username's...

finally came up with <ALT-F2> kdesu kwrite /root/.bashrc


So, can someone point me toward a better way to make a copy of whatever log(s) you feel would be relevant, after a crash/freeze-up etc.

I know this was an insanely long post, but I had to go to that much detail, so I could tell you how stupid I was with the whole 'exit' in my root/.bashrc file.

(and yes, I am familiar with the term PEBKAC)

Thanks for any input.

I will be slow to respond, working way too much overtime, (which causes me to forget 90% of what I taught myself each time I get a chance to work on this)

I do appreciate some advice.


Last edited by BigSmellyMonkey; 10-02-2011 at 01:43 AM. Reason: add some humor
Old 10-02-2011, 03:21 AM   #2
Registered: Sep 2011
Posts: 52

Rep: Reputation: Disabled
Why would you copy the logs somewhere in the first place if you can simply login as root and check them out where they are? Also the logs are rotated so nothing seems to be lost.


Last edited by zackwasa; 01-12-2012 at 02:10 AM.
0 members found this post helpful.
Old 10-02-2011, 08:36 AM   #3
LQ Newbie
Registered: Oct 2011
Location: Canada(don't judge Canadians based on how stupid I am)
Distribution: opensuse 11.3
Posts: 4

Original Poster
Rep: Reputation: Disabled
Well, my reason is that if I were to find the time to sit and review the logs, it would be much easier to find the problem if I had a dozen or so log files, where the end of each log file was the moment in time immediately after the crash/freeze-up.

I don't normally get more than a couple of hours in one shot to sit at my machine. And since I'm so new to linux, every time I sit down, I am learning. Learning a new OS, (and I don't mean learning how to use the GUI, but CLI) is difficult when you sometimes go weeks between 'lessons'.

I dunno, it might seem pointless to someone who understands what they are seeing every time they look at a log file. Or who has time to investigate each time something goes wrong.

Hope that makes sense.

I know there is probably a better method to debugging a problem...



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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to reduce LVM messages in /var/log/debug? catkin Linux - General 5 07-27-2011 02:46 PM
(Bash) Redirect all output from script to all.log and copy of errors to err.log hmsdefender Programming 5 03-05-2010 02:52 PM
Not able to get the debug symbols when process crashes meganath831 Programming 1 07-18-2008 04:00 AM
how to retain an original copy of mail in internet while fetching to Sendmail server deepugopi Linux - Server 0 06-26-2007 04:40 AM
Samba when I delete the original file sometimes deletes backup ewlnxnewB Linux - Newbie 6 11-20-2003 02:30 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:39 PM.

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