The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
help in wait or sleep command nua7 Shell Programming and Scripting 4 09-25-2008 06:41 AM
problem using sleep command lione.heart Shell Programming and Scripting 7 10-28-2007 04:06 AM
Sleep Command Glove Shell Programming and Scripting 1 10-03-2007 06:02 AM
sleep command leewar UNIX for Dummies Questions & Answers 3 09-11-2007 01:01 AM
How can I get a command to sleep < 1 second? mattd UNIX for Dummies Questions & Answers 1 08-04-2003 01:35 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-24-2008
dr46014 dr46014 is offline
Registered User
  
 

Join Date: Jun 2007
Posts: 94
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 loop is continues.Here the script that is inside the main script . /data1/xyz.sh takes some time and creates one 0 byte file after the script is executed.So i want to put a sleep command there and check every 5 mins if the file is created or not.if its is not created then one comamnd should be there to touch the file.if it is created then again it will take the coutn from database .. where and how to put that sleep command.

#!/bin/ksh
i=`sqlplus –s ………………………………………….`
while [ $i –gt 0]
do
. /data1/xyz.sh
----------------------sleep and check if file has been created
i=`sqlplus –s ………………………………………….`
done

please help me to write the complete script
  #2 (permalink)  
Old 10-24-2008
joeyg's Avatar
joeyg joeyg is offline Forum Staff  
modérateur
  
 

Join Date: Dec 2007
Location: Home of 17-time world champion Boston Celtics
Posts: 1,311
Wink

Code:
sleep 300
should wait 5 minutes

Code:
if [ -e myfile ]
  then
  do your stuff
fi
checks to see if file myfile exists
if so, then replace do your stuff with whatever you are trying to do
  #3 (permalink)  
Old 10-24-2008
dr46014 dr46014 is offline
Registered User
  
 

Join Date: Jun 2007
Posts: 94
Quote:
Originally Posted by joeyg View Post
Code:
sleep 300
should wait 5 minutes

Code:
if [ -e myfile ]
  then
  do your stuff
fi
checks to see if file myfile exists
if so, then replace do your stuff with whatever you are trying to do
the sleep should be in a loop.until the scriptis executed completely it would recursively check if the file is created.the script may check one hour or more.once the script is executed but if it doecnot create the file then there should be touch command to create a file
  #4 (permalink)  
Old 10-24-2008
dr46014 dr46014 is offline
Registered User
  
 

Join Date: Jun 2007
Posts: 94
Let me put my requirement in the otherway.The script i am running may have 3 kind of status at any point of time.Running,success or failed.We can get the status for a varibale stat.
So the loop should contunuously check the status of the job every 5 mins.

if stat='RUNNING'
sleep for next 5 mins and check the status again.If again it is RUNNING then sleep for next 5 mins and so on.If the status is FAILED then it should exit out of the loop.If the status is SUCCESS it should execute one command.

So the basic requirement is to check the stat varibale's value every 5 min and do the action as specified above.

Please help me put this requirenment in the script
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:04 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0