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...
# 1  
Old 01-31-2012
problem with sleep cmd in execution of cron...

I am scheduling a task at regular intervals at seconds acuracy using crond and sleep command . my data in crontab file is as below:-

Quote:
05 00 * * 0,4,5,6, sleep 45 && /usr/local/bin/set_radio_cron grp0 0 0 &
the above line is working fine when we are creating this crontab file before 00:05 min .
But when we are creating the crontab file at 00:05min , unable to execute sleep cmd. But the next cmd "/usr/local/bin/set_radio_cron grp0 0 0" is able to execute.

please guide me in this. what may be the problem? where i have to modify to make it work?
[as frm 00:05:00 to 00:05:59 has 1min duration and if i create the crontab file between this duration what will be the significance?]
Thanks in advance..
# 2  
Old 01-31-2012
What do you mean "unable to execute the sleep cmd"? What does it actually do?
# 3  
Old 01-31-2012
I mean that when the crontab file is created at 00:05:00 and executed at the same time. the " sleep 45 " command is not running and directly the second command is running. i.e "/usr/local/bin/set_radio_cron grp0 00 & "

I think now it is clear.
# 4  
Old 01-31-2012
Quote:
[as frm 00:05:00 to 00:05:59 has 1min duration and if i create the crontab file between this duration what will be the significance?]
The significance is that the next time cron will look at the line you changed will be tomorrow at 00:05. To be safe you really needed to complete the change to crontab by 00:04 .


Quote:
05 00 * * 0,4,5,6, sleep 45 && /usr/local/bin/set_radio_cron grp0 0 0 &
The highlighted comma and ampersand are neither needed nor desirable.

Last edited by methyl; 01-31-2012 at 01:22 PM..
# 5  
Old 02-01-2012
@ above

But actually when i am creating the crontab file in-between 00:05:00 to 00:05:59 the second command is being executed but the 1st command i.e sleep 45 is not running.
# 6  
Old 02-01-2012
Quote:
Originally Posted by manoj424
@ above

But actually when i am creating the crontab file in-between 00:05:00 to 00:05:59 the second command is being executed but the 1st command i.e sleep 45 is not running.
I hope you have removed &

Secondly, are you sure that Sleep command did not get executed?
# 7  
Old 02-01-2012
Quote:
I hope you have removed &
I didn' t get u.
where I have to keep "&" .
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