Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I want to create a cron job which will run every 5 minutes. I have understood the concept of setting the condition of 'every five minutes' from a previous answer on the same topic. However, i do not understand the part where it says /path/to command. i have the format for every 5 minutes as */5 * * * * and i have set root as the user. The job i want to be have run every 5 minutes is executed by the following command

snmpbulkwalk -v 2c -c public -OXsq  172.16.1.210 \
      .1.3.6.1.2.1.3.1.1.2 > /tmp/S01_ARP.txt

How can i add this cron job properly

share|improve this question

2 Answers 2

up vote 4 down vote accepted

The /path/to/command is the the path to the bin file of your command snmpbulkwalk. When you run snmpbulkwalk, you're actually running its binary file which is located probably in /bin or /usr/bin. To find out what this path is, run which snmpbulkwalk. Let's say this returns /usr/bin/snmpbulkwalk. Therefore, your cronjob would be:

*/5 * * * * /usr/bin/snmpbulkwalk -v 2c -c public -OXsq  172.16.1.210 .1.3.6.1.2.1.3.1.1.2 > /tmp/S01_ARP.txt
share|improve this answer
    
Ah now I see what he means... Ok. –  don.joey Aug 21 '13 at 12:29

If I understand you correctly you want to know how to setup this cronjob. Just hit

 crontab -e

Then choose your favorite editor (for me that's vim) copy and paste the line above and make sure it is followed by a white line. Then save it (in vim you hit ESC and type :wq. Then you can check whether it is in the cron file by typing:

crontab -l

If am not mistaken you can check in which folder your cron job starts by adding a cron job like:

* * * * * env > env-output.txt

and then read the env-output.txt file after a few minutes. This file will contain your path and all that sort of stuff. But maybe your command might work out of the box.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.