Home Man
Search
Today's Posts
Register

This forum is closed for new posts. Please post beginner questions to learn unix and learn linux in the UNIX for Beginners Questions & Answers forum.

Crontab job is not working

Tags
beginners

 

 
Thread Tools Search this Thread
# 1  
Old 03-04-2016
Crontab job is not working

hell all:


i am trying to test a crontab job for snmpwalk but it is not working:


here is crontab:
Code:
*/1    *    *    *    *    root    /root/snmpwalk.sh




for the script, it is very simple:


Code:
#!/usr/local/bin/bash

/usr/local/bin/snmpwalk -v 2c -c public 100.10.10.10


from the log, i can see this
Code:
Mar  4 15:22:00 snails /usr/sbin/cron[88515]: (operator) CMD (/usr/libexec/save-entropy)
Mar  4 15:22:00 snails /usr/sbin/cron[88516]: (root) CMD (root^I/root/snmpwalk.sh)
Mar  4 15:23:00 snails /usr/sbin/cron[88531]: (root) CMD (root^I/root/snmpwalk.sh)
Mar  4 15:24:00 snails /usr/sbin/cron[88534]: (root) CMD (root^I/root/snmpwalk.sh)



thanks.



_dave

Last edited by Don Cragun; 03-04-2016 at 10:31 PM.. Reason: Add CODE tags.
# 2  
Old 03-04-2016
I don't know what the root command on your system does. And, I don't see from the details you have given us why you believe something is wrong.

The log shows that over a period of three minutes, cron ran the command:
Code:
root	/root/snmpwalk.sh

three times as requested.

What else happened that you didn't expect to happen? What didn't happen that you expected to happen?
# 3  
Old 03-05-2016
Quote:
Originally Posted by Don Cragun
I don't know what the root command on your system does. And, I don't see from the details you have given us why you believe something is wrong.

The log shows that over a period of three minutes, cron ran the command:
Code:
root    /root/snmpwalk.sh

three times as requested.

What else happened that you didn't expect to happen? What didn't happen that you expected to happen?

thanks don:

all i want to do is to execute follow command every minute:

Code:
/usr/local/bin/snmpwalk -v 2c -c public 100.10.10.10

i thought crontab job should do it. actually i removed that user "root", instead here

Code:
*/1    *    *    *    *    /root/snmpwalk.sh

it still not doing i expected.

so i ran this test manually and it worked fine:

Code:
/usr/local/bin/bash /root/snmpwalk.sh

---------- Post updated 03-05-16 at 12:05 AM ---------- Previous update was 03-04-16 at 11:14 PM ----------

thanks don:

typo... sorry.

Last edited by ipfreak; 03-04-2016 at 11:22 PM..
# 4  
Old 03-05-2016
What output do you get from the commands:
Code:
ls -l /root/snmpwalk.sh;cat /root/snmpwalk.sh

And, what happens if you just put the line:
Code:
*/1    *    *    *    *    /usr/local/bin/snmpwalk -v 2c -c public 100.10.10.10

or the line:
Code:
*/1    *    *    *    *    /usr/local/bin/bash /root/snmpwalk.sh

in root's crontab file?
# 5  
Old 03-05-2016
I don't know how the command snmpwalk is managed internally within the OS so I would ask the question whether there are any implications if when the cron job is triggered the previous run hasn't finished; i.e. the command takes over one minute to run?

Would that cause any adverse effects? I just dunno whether there would be any open/locked files/interfaces.

Last edited by hicksd8; 03-05-2016 at 01:50 PM..
# 6  
Old 03-05-2016
Does your cron understand the */1?
Otherwise use *.
# 7  
Old 03-06-2016
Do you have the cron log for the modified entry in the crontab?

Just as MadeInGermany said, */1 is nothing but *
 

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Crontab not working Junaid Subhani Shell Programming and Scripting 7 06-06-2015 03:02 PM
A crontab job not working JDBA SuSE 2 05-05-2014 08:17 AM
Crontab not working krebe Linux 4 02-12-2013 04:50 AM
Crontab not working, please help samantha13 UNIX for Advanced & Expert Users 0 08-02-2012 12:25 PM
crontab not working shifahim UNIX for Dummies Questions & Answers 8 08-16-2011 08:22 AM
crontab is not working. getrue Solaris 6 07-27-2011 12:34 AM
crontab not working lg123 UNIX for Dummies Questions & Answers 2 04-24-2011 03:47 PM
crontab not working rajesh_hv UNIX for Advanced & Expert Users 4 10-28-2008 07:45 AM
crontab NOT working baanprog UNIX for Advanced & Expert Users 2 09-26-2006 12:11 PM
crontab not working right kymberm UNIX for Dummies Questions & Answers 3 07-09-2003 04:21 PM


All times are GMT -4. The time now is 07:47 AM.

Unix & Linux Forums Content Copyrightę1993-2018. All Rights Reserved.
UNIX.COM Login
Username:
Password:  
Show Password