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 11: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-05-2016 at 12:22 AM..
# 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 02: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 - entry not working , cron job not running vijaymec50 Shell Programming and Scripting 13 11-14-2014 05:43 AM
A crontab job not working JDBA SuSE 2 05-05-2014 09:17 AM
Crontab Job Syntax JolietJake Shell Programming and Scripting 1 06-28-2013 10:43 PM
Crontab job scheduler problem guddu_12 Shell Programming and Scripting 2 11-05-2012 10:22 AM
crontab job not executed with variables turki_00 Shell Programming and Scripting 4 10-04-2012 10:01 AM
job run before schedule on crontab michlix AIX 6 12-13-2011 10:31 PM
Problem with Job execution using crontab krishna_gnv Shell Programming and Scripting 4 11-10-2011 07:53 AM
To Run a job every hour without using crontab glv Shell Programming and Scripting 3 11-08-2011 06:32 AM
Schedule a job using Crontab jatanig Shell Programming and Scripting 1 03-15-2010 10:45 AM
crontab job not running ilpasta UNIX for Dummies Questions & Answers 5 01-27-2009 10:42 AM
Crontab job to run every sunday govindts Shell Programming and Scripting 2 12-15-2008 05:01 PM
Run crontab job problem ust UNIX for Advanced & Expert Users 3 07-23-2007 10:45 PM
Help with a crontab job!!! kumarsaravana_s Shell Programming and Scripting 4 03-28-2007 05:02 AM
Crontab job queue pksingh2 UNIX for Dummies Questions & Answers 1 08-22-2006 12:38 AM
crontab job Moe UNIX for Dummies Questions & Answers 3 11-02-2005 05:17 PM


All times are GMT -4. The time now is 12:08 PM.

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