[PLUG] top > file scheduling

Pranav Peshwe pranavpeshwe at gmail.com
Sun Feb 8 20:02:20 IST 2009


On Sun, Feb 8, 2009 at 5:45 PM, Kulkarni Shantanu <
linux at shantanukulkarni.org> wrote:

> * Abhishek Nagar <nagar.ksp at gmail.com> [090208 17:27]:
> > i need to store the output of "top" in a file five times a day, so i
> > planned to put it in cronjobs but it doesnot work what could be the
> problem
>
> do you have problem with top or with cron? If with top, you might want
> to try,
> # top -b -n1
>
> for cron, you can say like this in crontab,
>
> 00 09,11,13,15,17 * * * /usr/bin/top -b -n1 >> /tmp/top.log
>
>
> substitute the hour field with your required value.
>
>
Shantanu has already given an example. Adding a little explanation to it -
when running a command from cron, the available $PATH variable may not
include the usual list of directories which contain commands(binaries), so,
it is safe and recommended to give the full path to whatever binaries you
use in the cronjob.

HTH...

Best regards,
Pranav



More information about the Plug-mail mailing list