Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Setting up a cron job to backup an errors file once a month

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
Lady Aleena
Posts: 20
Joined: 2013-12-06 07:48

Setting up a cron job to backup an errors file once a month

#1 Post by Lady Aleena »

Hello everyone.

Yesterday I was looking at my directory listing without human readable on, when I saw that ~/.xsession-errors was over 17M. I opened it to see what was in there and saw mostly warnings. After investigating for a while with the help of the good people on IRC, I was guided to the conclusion to let things be. However, I would like to have a more sane ~/.xsession-errors file in my home directory.

So, what I would like to do is copy the current error file into a directory called ~/.xsession-errors-logs at midnight on the first day of the month with the name .xsession-errors-YYYY-MM-DD. Then I would like the error file in my home dir cleared for the next month's errors. Also, I would like to keep the amount of files in the -logs directory down, so would like to delete the file from six months prior.

Now, I have known about cron jobs but have not used them before. I looked into it, and it appears that it would be better if I scripted the above commands, and then put that script into the cron job. However, I am not sure the best way write the script to get what I want.

I don't even know if I am thinking about this correctly, so any corrections to how I should think about this would be wonderful.

I appreciate all help offered. Thank you for reading.


Post Reply