LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   mtr (https://www.linuxquestions.org/questions/linux-newbie-8/mtr-719285/)

mahmoud 04-15-2009 08:14 AM

mtr
 
Hi
i have a script to run a couple of commands but it doesnt run mtr
from the cron jon
when i run the script manualy it works but when its in the cron it doesnt
here is the command
mtr -n -p -c 2 192.168.2.1 >> /file/
has anyone had this same problem and can anyone help

colucix 04-15-2009 08:16 AM

As a general rule, you have to use the full path of the commands inside a cron job, since the crontab has a very limited environment and the PATH variable is usually limited to /bin:/usr/bin. Put the full path to mtr and it should work from the crontab as well.

mahmoud 04-20-2009 10:54 AM

Hi
Thanks for that its works but it keeps running even with the option for only 1 count
/usr/sbin/mtr -r -n -p -c 1 192.168.2.2

TB0ne 04-20-2009 12:06 PM

Quote:

Originally Posted by mahmoud (Post 3515191)
Hi
Thanks for that its works but it keeps running even with the option for only 1 count
/usr/sbin/mtr -r -n -p -c 1 192.168.2.2

Right...based on your command line, it would. Did you read the MAN page for mtr?

-i is the interval in seconds, between ICMP requests. 1 second is the default.

john test 04-20-2009 02:59 PM

Could it have something to do with cron job iterations? The -c 1 option runs the command a single time.


All times are GMT -5. The time now is 12:38 PM.