LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Help Needed Urgently (https://www.linuxquestions.org/questions/linux-newbie-8/help-needed-urgently-715954/)

hasan_sust 03-31-2009 11:28 PM

Help Needed Urgently
 
Dear All

I am new to linux. Yesterday I craete a shell script to monitor the entry of arp cache. The script is as follows:



[root@localhost opt]# cat arpmonitor.sh

#!/bin/bash
echo '#############################'>>/opt/monitor
date >>/opt/monitor
echo '#############################'>>/opt/monitor
arp -n | awk '{print $1}' >> /opt/monitor



When I execute this script using the command ./arpmonitor it gives the following output


#############################
Wed Apr 1 10:05:02 BDT 2009
#############################
Address
172.10.4.1
172.10.4.172
172.10.4.76
172.10.4.163


I want to run this script within 5 minutes interval. So I add following
lines into the crontab

*/5 * * * * /opt/arpmonitor.sh


Then I check the output and found the following entry at output file.

#############################
Wed Apr 1 10:15:01 BDT 2009
#############################
#############################
Wed Apr 1 10:20:01 BDT 2009
#############################

That means arp -n | awk '{print $1}' >> /opt/monitor this command isn't executed.



Waiting for a prompt reply. Thanks in advance.

repo 04-01-2009 02:37 AM

Give the whole path to the commands
eq
/usr/sbin/arp
/bin/date
....

TB0ne 04-01-2009 09:33 AM

Quote:

Originally Posted by hasan_sust (Post 3494483)
Dear All

I am new to linux. Yesterday I craete a shell script to monitor the entry of arp cache. The script is as follows:


That means arp -n | awk '{print $1}' >> /opt/monitor this command isn't executed.

Waiting for a prompt reply. Thanks in advance.

Don't post things as URGENT. This isn't urgent for anyone but you, so don't tell us to give you a prompt reply. We all volunteer our time here, and answer questions as we can, at our leisure.

If you want a quick, prompt reply, hire a consultant.

farslayer 04-01-2009 09:53 AM

there is also arpwatch and arpalert if you want a tool that is already written..

archtoad6 04-08-2009 04:37 AM

Quote:

Originally Posted by TB0ne (Post 3494960)
Don't post things as URGENT. This isn't urgent for anyone but you, so don't tell us to give you a prompt reply. We all volunteer our time here, and answer questions as we can, at our leisure.

If you want a quick, prompt reply, hire a consultant.

Remember that LQ is a worldwide group & therefore half of us are asleep or at work at any given time.

Also, please use descriptive thread titles -- something that summarizes your problem.

BTW, I believe you can edit your thread title. If you'll do that here & make it descriptive of your problem, I'll read it & try to help.


All times are GMT -5. The time now is 06:16 AM.