problem with sleep cmd in execution of cron...


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting problem with sleep cmd in execution of cron...
# 8  
Old 02-01-2012
In your given Crontab Entry:
Code:
05 00 * * 0,4,5,6, sleep 45 && /usr/local/bin/set_radio_cron grp0 0 0 & 

I can see there is & and one extra comma marked red there.
# 9  
Old 02-16-2012
Quote:
05 00 * * 0,4,5,6, sleep 45 && /usr/local/bin/set_radio_cron grp0 0 0 &
In above the sleep command is not working but the other command "/usr/local/bin/set_radio_cron grp0 0 0" is working for only below condition.
-> when present time is hr 00:05:12 sec , given time hr 00:05:00 sec

The above quoted command is working fine when :
-->when present time is hr 00:04:12 sec , given time hr 00:05:00 sec

please comment on above ...
# 10  
Old 02-16-2012
If I understand this discussion properly, you are creating a crontab "on the fly", perhaps just one minute before it is timed to run? Why?

Crontabs are normally set up and left alone. The crontabs are read into memory when the kernel boots and the last modified date/time of the crontab is also remembered. "Periodically" the cron daemon will inspect the crontabs to see if anything has changed (by looking at the last modified date/time) and if it has, it will reload that table. Therefore, to my mind, there is no guarantee that a crontab created one minute before it is due to run will be executed one minute later. The cron daemon might not have seen the change by then.

Can any other forum members confirm what I've just said please.
# 11  
Old 02-16-2012
@manoj424
The cron fires at 05:00 exactly, precisely, and to the millisecond.
Any change you make after that time is too late.
Get it?


I agree that you should also give cron a minute or more to see the change. This varies from system to system. The benchmark would be the second the "crontab -e" command finishes.
There is no way that a change made after 05:00 to a cron scheduled at 05:00 would be actioned until the following day.

Last edited by methyl; 02-16-2012 at 06:39 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Execution problem with Cron

Hi, I'm unable to understand why the grep command in cronjob works intermittently Expected output: Grep command to look for a particular string with today's date and exit from infinite while loop else it must sleep for 5 mins I'm using the following statement in my shell script, the... (9 Replies)
Discussion started by: charlie87
9 Replies

2. Shell Programming and Scripting

Execution problem with CRON job

HI, I have written an executable file in unix and I was able to execute it successfully but when I called this file with cron job it was giving error like "permission denied" and "No such file or directory". Please help in how cron calls the file and what permission is required on the file... (2 Replies)
Discussion started by: vipin kumar rai
2 Replies

3. UNIX for Dummies Questions & Answers

Execution problem with Cron: Script works manually but not w/Cron. Why?

Hello gurus, I am making what I think is a simple db2 call from within a shell script but I am having difficulty producing the desired report when I run the script shown below from a shell script in cron. For example, my script and the crontab file setup is shown below: #!/bin/ksh db2... (3 Replies)
Discussion started by: okonita
3 Replies

4. Shell Programming and Scripting

UNIX cmd -find empty files in folder else sleep for 8hrs

Hello, I am trying to write a unix cmd , that if files in folder /path/FTP are all zero kb or empty then good to go, if not empty then sleep for 8 hrs. Following cmd list me the files which are not empty, But when I am incorporating IF ELSE cmd fails find /path/FTP. -type f -exec wc -l {}... (6 Replies)
Discussion started by: bluestarmoon
6 Replies

5. Shell Programming and Scripting

Perl open(CMD, "cmd |"); buffering problem..

Hello, There's a third-party application's command that shows the application's status like "tail -f verybusy.log". When use the command, the output comes every 1-sec. but when it goes in a script below the output comes every 8-sec...What is the problem and how can I fix it? open(CMD,... (2 Replies)
Discussion started by: Shawn, Lee
2 Replies

6. AIX

Execution Problem with Cron

Guys, I am beginer in unix. There is a cobol file with fixed-width. I want to read the total Line, Word and character count. I have tried with wc-l unix command, but it returns '0'. Please advice me the correct command/steps to get the record count. Thanks in advance. (4 Replies)
Discussion started by: vibhar
4 Replies

7. Shell Programming and Scripting

find cmd works different on cron job ?

/usr/bin/find $SEARCH_DIR -daystart \( \( -name 'KI*' -a -name '*.csv' \) -o -name '*_xyz_*' \) -mtime $DAYS_AGO -printf %f -printf "\n" | sort -r > $FILES The above command gives different results when run on a cron job. When run manually the result is accurate. (2 Replies)
Discussion started by: nuthalapati
2 Replies

8. Programming

popen hangs program during cmd execution

How can I get around this? when my program reaches the following popen job it halts the program until the ping/netstat/ipconfig/traceroute is completed then resume to the rest of the program... FILE *in; extern FILE *popen(); char buff; char newline; char nstat; char nping; ... (5 Replies)
Discussion started by: Jess83
5 Replies

9. Solaris

Solaris 10.5 perl and cron job execution problem

Hi, I want to run a crontab job on solaris 10.5. I have configured the crontab accordingly 10 * * * * /scripts/dbalter.pl >> /scripts/cronout.txt However this does not work .Then I go to /var/mail/root and find an error in the output: From root@myserver Wed Feb 4 17:02:00 2009... (1 Reply)
Discussion started by: sonu2die4
1 Replies

10. Solaris

cron execution

Hi, Here is the code snippet when executing on the command line it does execute smoothly, but while i place this on cron it doesnt run. Can anybody suggest where the problem in cron is.? #!/usr/bin/ksh home_dir="/export/home/scripts/MonitorScripts" ThresholdLimit=5 touch... (6 Replies)
Discussion started by: rameek20
6 Replies
Login or Register to Ask a Question