using a shell script to close a minicom log file and open a new one.
I have built a microprocessor board which will allow me to log my hydro usage. It involves a photo diode on my hydro meter which counts flashes.
Every 10 minutes I send the kWh out the serial port. Obviously I am power conscious and so I am connecting this to one of my servers which is on anyway.
I am then using minicom to collect the data but it is very hard to look at as one big fat file. What I want to do is have a cron job call a shell script to close the previous days log file and then start up another one for the present day.
So, at say 12:05 am, close off the present minicom log file and start a new file using the new date as the file name.
So, I will have one file per day.
I did figure out how to start minicom and start logging with a file name made from the present date.
Here is my script so far:
Any help is greatly appreciated.
Thank you - Steve
There's probably no need to reinvent the wheel. Have a look at logrotate.
Also, please use [code][/code] tags around your code, to preserve formatting and to improve readability.
You are a genius!
I never thought about logrotate nor did I realise how it works and can apply to minicom.
Thank you for your help- Steve
PS- Thanks for the tip on [CODE]
|All times are GMT -5. The time now is 09:54 PM.|