Sleep command did not worked


Login or Register for Dates, Times and to Reply

 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Sleep command did not worked
# 1  
Sleep command did not worked

Hi All,

We have a process which is running for last 2 years well and good in production. But suddenly yesterday there was issue we faced in the process.

The actual process is what it does like below.

1. Receive the files in NAS directory(N/w attached storage).
2. Trigger the process(some.ksh script) one for each file in the NAS directory in gap of 1 second, this is in for do - done loop.

This is running well and good till yesterday but suddenly there were 3 parallel process triggered for 2 files in NAS directory at same time (For ex: 11:30:10 AM). So initial analysis say there is nothing wrong in code which was actually fine but some how the sleep command was not worked.

Is there any thing behind which makes sleep command not to work?
Any comments suggestions will be helpful.

I am using AIX 6.0 version of UNIX server.

Thanks.
This User Gave Thanks to mad man For This Post:
# 2  
My crystal ball is a little cloudy this morning. I am unable to see the sleep command in your code that you don't think is working.

Maybe you could show us your code, any logs and diagnostics produced, and explain why you think sleep is failing (and what the symptoms are when sleep fails)???
# 3  
Code:
  
 echo " Calling system_router.ksh"  `date` " <<<<<\n" >>$temp_log 
 nohup /$TLExxxx/scripts/appldata_proc.ksh >/dev/null 2>&1 & 
 sleep 1

Hi Dan here is the piece of code which makes the gap between files in NAS directory.

I am also showing sample log fragments which i feel could help here.

Code:
Normal run process start timing:
>>>>>	starting	appldata_proc.ksh	Fri	Aug	25	10:29:20	EDT	2017	<<<<<
>>>>>	starting	appldata_proc.ksh	Fri	Aug	25	10:29:19	EDT	2017	<<<<<
>>>>>	starting	appldata_proc.ksh	Fri	Aug	25	10:29:17	EDT	2017	<<<<<
>>>>>	starting	appldata_proc.ksh	Fri	Aug	25	10:29:18	EDT	2017	<<<<<

Code:
Problematic run process start timing:
>>>>>	starting	appldata_proc.ksh	Mon	Aug	28	10:45:12	EDT	2017	<<<<<
>>>>>	starting	appldata_proc.ksh	Mon	Aug	28	10:45:12	EDT	2017	<<<<<
>>>>>	starting	appldata_proc.ksh	Mon	Aug	28	10:45:12	EDT	2017	<<<<<

The application main driver was missing 1 second sleep timing.

Thanks.
# 4  
What you have shown us is a script that writes a timestamp into a log file (which you haven't shown us), starts a process running in the background, sleeps for a second and exits. There is absolutely no indication that the sleep you have shown us should have any effect whatsoever on the behavior of this script.

What is producing the sample log fragments you did show us? Is it coming from appldata_proc.ksh? (It is not coming from the echo in the code you did show us!)

What does the log that you did show us have for several seconds before and after the three lines that show a timestamp of 10:45:12?

Note that there is no reason to believe that a script that is started every second will finish every second. On a busy system, several invocations of appldata_proc.ksh could be running at the same time even if one invocation of appldata_proc.ksh usually runs in much less than a second.
# 5  
And on top of the questions Don already asked: the first line of your appldata_proc.ksh should show which shell you use: Default shell in AIX 6.0 (out of service, btw.) is ksh88 but AIX offers a ksh93 too as /usr/bin/ksh93.

bakunin
# 6  
Hi All,

The actual issue was found, the issue what happen is these parallel running scripts are sharing a folder in server to pick the corresponding processing files. At that point of time when these scripts were running the server is 100% busy and even when we have sleep 1 in script the scripts became slow and started to run parallel so the when the second process runs it also picked the file names of first process and its own (first process file name was not suppose to be in there at this point of time). So the second process used the first process file name and failed.

We have planned to pass the file name as argument instead of picking up from shared folder.

Thanks.
# 7  
That sounds much more reliable.
Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #781
Difficulty: Medium
At 17, Bill Gates formed a venture with Steve Ballmer called Traf-O-Data to make traffic counters based on the Intel 8008 processor.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sleep command

I need help in script. I want my one script execute every time at 6:30 am and i have no cron access. So i am putting sleep command there , Script may took half an hour 35 min , it depend upon queries how much it take time, but that is not issue, So i want according to stop time of... (15 Replies)
Discussion started by: pallvi_mahajan
15 Replies

2. Shell Programming and Scripting

Help with sleep command:

Hi Frnz, I need to execute sleep command but i dont know the definite time. Let me put my req: I am running one shell script and this script creates some lock file in temp dir ...now in my script i want one function to go into sleep mode till this lock file exists..one lock file gone that... (6 Replies)
Discussion started by: gnnsprapa
6 Replies

3. Shell Programming and Scripting

Sleep Command

Hello, Need a little help with the script below. I can't get it to sleep :( I'm trying to get this to check if the process is running and if it is, wait 10 secs and check again. Keep doing this until it's not running and then stop checking and send the email. #!/bin/ksh mailto=`cat... (2 Replies)
Discussion started by: bbbngowc
2 Replies

4. UNIX for Dummies Questions & Answers

sleep command off by a second

Hi Forum Im using sleep in a while loop goes around 10 times. i feed it a variable with the time i what it to sleep for eg sleep $sleepVal and then print system date and time to screen but sometimes 1 second is added to the time why is this here my code sleepVal=5 while do ... (3 Replies)
Discussion started by: ShinTec
3 Replies

5. UNIX for Dummies Questions & Answers

Help with sleep command

sleep 10 & Is this the write line of command to suspend 5 jobs for 10 minutes (6 Replies)
Discussion started by: senyor17
6 Replies

6. Shell Programming and Scripting

sleep command

Hi, Did the sleep command work for hours or only minutes just give description to work on my script waiting for the earliest response (5 Replies)
Discussion started by: thelakbe
5 Replies

7. UNIX for Dummies Questions & Answers

sleep command

Hi All I have a requiremnt to run a script inside another script. here i am pulling the record count from the table in oracle.If record count is greater than 0 the script is executed.The scripts updates the count in the table and again the count is found out and the condition is checked and same... (3 Replies)
Discussion started by: dr46014
3 Replies

8. Shell Programming and Scripting

Sleep Command

I am in need of some help; think I have confused myself. Here is the issue I am faced with. The script log file was fine, the nohup.out file has tens of thousands of lines like illegal use of sleep: sleep seconds So I assume there is something with the seconds calculation in the script... (1 Reply)
Discussion started by: Glove
1 Replies

9. UNIX for Dummies Questions & Answers

sleep command

If I give sleep(50) what does it mean? My program waits for further execution or all my other processes wait? (3 Replies)
Discussion started by: leewar
3 Replies

10. UNIX for Dummies Questions & Answers

How can I get a command to sleep < 1 second?

I am running a number of processes through a kill -15 loop as a temporary fix to some viscious memory leaks. I cannot pass the entire list of processes through the kill at once, because the nature of the monitoring my client has will cause the software to failover. Because of the large number of... (1 Reply)
Discussion started by: mattd
1 Replies

Featured Tech Videos