Hi,
I am using HP-UX.
I have an output log file which gives me server statistics.
I want to export the contents of the file(last 100 lines) using tail command and then save it into an excel file in my local machine.
The server statistics should be collected every 3 hrs.
So, i wanted the idea as to how to go about in writing the script so that every 3hrs the batch file runs and exports the log file output into my excel file.
Sample record is given below:
Thu Jan 21 08:35:00 CST 2010 : 1172320 226 613 nqsserver
will get you editing the cron; you want to add a line like:
*/3 * * * * fetchLog.sh
, which is the instruction to run fetchLog.sh every 3 hours. fetchLog.sh needs to be in your path, so that cron can find it (or call with full path).
But if it's that simple, you don't even need a wrapper script.
*/3 * * * * tail -100 /path/to/log >> capture.txt
would get you logging.
You can generate a comma separated text file (.csv), that can be imported into M$ Excel.
I recommend you look at crontab in more detail; it's not quite trivial and you should have a good understanding of it before you use it.