LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Taking back up of log file for running process/ (https://www.linuxquestions.org/questions/programming-9/taking-back-up-of-log-file-for-running-process-789391/)

route 02-16-2010 12:52 AM

Taking back up of log file for running process/
 
I am working in HP UNIX
I have one process which is runnuing continusly.There is log file generated for the process. I want to take back up of file without loosing any logs after perticular interval of time or say file size increases more that 1GB.
what can be possible solution?

smoker 02-17-2010 08:16 AM

Set up a cron job with the correct privileges to move and rename the existing log once a day to a backup log. Then touch a new log file.
You don't say what the process is, is there a facility to specify maximum log file size ?
Have a look how other log files are handled and copy the format.

regards

Alan

route 02-17-2010 11:44 PM

Its a JVM process generating sysout.log
can u please explain me how can i set crons?.

smoker 02-18-2010 05:15 AM

I suggest you check out
Code:

man -a crontab
on your system for accurate details of your crontab set up.
Basically you write a shell script to copy and rename your file, and use crontab to run that script as specific times.

I can't help much more than that, because there are details about the job I don't know.
Things to consider -
Has the JVM got a lock on the log file preventing any other access while it's running ?
When is the quietest time to do the change ?
How long are you going to keep the backups ?

etc.


All times are GMT -5. The time now is 11:07 PM.