Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
Nandhakumar_N
Participant

Unable to create cron job for arp

Unable to create cron job with below command 

add cron job CCTeam_ArpEntry command "arp" recurrence daily time 12:03 and sendin this output to my email.

This is what I am getting in email "/bin/bash: arp: command not found"

 

Same time if I do given command "uptime" in cron job, email output shows fine.

 

Am I missing something here?

0 Kudos
7 Replies
_Val_
Admin
Admin

Check manually if "arp" is available with bash

 

0 Kudos
Nandhakumar_N
Participant

Checked manually arp is there.

0 Kudos
Bob_Zimmerman
Authority
Authority

 

[Expert@DallasSA]# which {arp,cat,uptime}
/sbin/arp
/usr/bin/cat
/usr/bin/uptime

 

cronjobs are run in a non-interactive, non-login shell instance. From looking at an R81.10 system, it appears /sbin is added to the $PATH in /etc/profile, which is only run for login shell instances.

Include the full path to arp in your cronjob specification, or make a shell script which starts with '#!/usr/bin/bash --login' and run that script in your cronjob.

0 Kudos
Nandhakumar_N
Participant

I am not sure what full command you are asking me to specify in CLI?

I am using this command for running cron job and it works perfectly.

add cron job CCteam_ArpEntry2 command "cat /proc/net/arp | grep eth1.70 | sort -k 6" recurrence weekly days 1,2,3,4,5 time 10:00

I don't want to complicate much. 

0 Kudos
Bob_Zimmerman
Authority
Authority

Like I said, the full path to arp. A non-interactive, non-login instance of BASH doesn't know to check /sbin for executables. When you try to run 'arp' without the full path, it won't work because BASH can't find an executable with that name, which is what the error "command not found" is telling you.

0 Kudos
the_rock
Legend
Legend

Whats exact command you used? If you send it, I will try it in the lab.

Andy

0 Kudos
Nandhakumar_N
Participant

cat /proc/net/arp command works fine 

 

 

0 Kudos

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events