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?

7 Replies
_Val_
Admin
Admin

Check manually if "arp" is available with bash

 

Nandhakumar_N
Participant

Checked manually arp is there.

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.

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. 

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.

the_rock
Legend
Legend

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

Andy

Nandhakumar_N
Participant

cat /proc/net/arp command works fine 

 

 

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events