top scheduling...

tasks tasks and tasks... you always need to monitor them but how to schedule this monitoring so that i can get a file generated say every hour or four hours. You normally use the following command to transfer the output of top to a file

$ top > filename

and this works fine for you have you ever tried to add this entry as a cron job believe me it wont work i struggled a lot with it so finally whats the solution to schedule it The answer is use cron job, but i just said it wont work :) yes this wont work directly you need to add certain flags hey dont work you need not search them, below is the line which you can add as your cron job

17 15 * * * root /usr/bin/top c n 1 b >/home/abhishek/topfile_$(date +\%Y-\%m-\%d-\%H-\%M) if this doesnot work in your case the following would surely work 17 15 * * * root /usr/bin/top c n 1 b >/home/abhishek/topfile_`date +\%Y-\%m-\%d-\%H-\%M`

the above statement will make a cron run every day at 17:15 which would create a file in /home/abhishek/topfile_somedatetime  containing the required information. Hey you can change this to any time or frequency or any format of file name you need just use study cron or have a look to my earlier post on cron jobs.