Today (Saturday) We will make some minor tuning adjustments to MySQL.

You may experience 2 up to 10 seconds "glitch time" when we restart MySQL. We expect to make these adjustments around 1AM Eastern Daylight Saving Time (EDT) US.


Crontab job is not working


 
Thread Tools Search this Thread
# 1  
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  
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  
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  
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  
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..
# 7  
Do you have the cron log for the modified entry in the crontab?

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

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Crontab - entry not working , cron job not running
vijaymec50
I have put a cron entry in oracle user for taking hot backup every wednesday@ 2.30 AM and have given the cron entry 30 02 * * 3 /u01/vijay/hotbackupcron 2>&1 >> /u01/vijay/hotbackup.log also find below the script inside hotbackupcron, i have put in env variables as well ...... Shell Programming and Scripting
13
Shell Programming and Scripting
A crontab job not working
JDBA
Hello, This is my first posting in Linux world. I have SLES 11. I've created a file 'packdisk-scandisk.txt' file under /var/opt/Teradata/bteqdba. The content of the file is, cat /var/opt/Teradata/bteqdba/packdisk-scandisk.txt output over /var/opt/Teradata/bteqdba/TAREAS_DBA.log...... SuSE
2
SuSE
Crontab Job Syntax
JolietJake
I have a ksh script that does the following 1. Script executes and creates an output file from a sql query 2. That output file is an input file to the script 3. generates an html file to email to DBA receipients The following syntax works at the command line ...... Shell Programming and Scripting
1
Shell Programming and Scripting
Help with a crontab job!!!
kumarsaravana_s
Hi, i need to schedule a script to run at 6.10AM everyday.I tried to do this way. #!bin/ksh 10 06 * * 0-6 sh /tmp/ss/script/daily_file_check.sh And at the command prompt I did >crontab e cron.txt Im not sure whether this is the right way. Can anyone please tell me how to...... Shell Programming and Scripting
4
Shell Programming and Scripting
crontab job
Moe
Hi, I have cornjob was scheduled at 1:00 AM everyday. It has been running fine since last Saturday. But it didn't run since Saturday. Because of daytime saving time change it didn't ran? Please send me your thoughts. Thanks in adavance. Moe... UNIX for Dummies Questions & Answers
3
UNIX for Dummies Questions & Answers

Featured Tech Videos