Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to raise error if script running too long. 2

Status
Not open for further replies.

hokky

Technical User
Nov 9, 2006
170
AU
Hi guys,

I just wanna know the Idea how to raise an error if my script running too long. let's say 10 minutes.

Thanks heaps guys.
 
Hi

Do you mean, the script itself to raise the error ? And more exactly what do you mean to raise error ?

Could be two ways :
[ul]
[li]the script itself regularly checks the elapsed time, for example in each turn in a loop[/li]
[li]another process checks if the script is still running[/li]
[/ul]
But of course, if you give us more details, we could suggest a more suitable solution.

Feherke.
 
Ok,

Here's the sample of the script :
Code:
...

Script1 & Script2 & Script3 & Script4

if script 1 running for more than 10 mnts
  echo "Script1 running too long" > log_script1
fi

if script 2 running for more than 15 mnts
  echo "Script2 running too long" > log_script2
fi

if script 3 running for more than 20 mnts
  echo "Script3 running too long" > log_script1
fi

if script 4 running for more than 25 mnts
  echo "Script4 running too long" > log_script1
fi

Script5

...

But if the script finish before that it's beautiful, continue to the next script

Thanks man
 
Try looking at thread822-1240704 which deals with a very similar problem

Ceci n'est pas une signature
Columb Healy
 
ps -aC daemon_name|awk -F ":" '($2 > 10){print}'

would show $daemon_name if it was running over 10 minutes... Its a start on killing it from there... (feherke)

I kill Asterisk calls that won't die since the version I use has hang up issues with the following running from cront:


/usr/sbin/asterisk -rx "show channels concise" | awk -F : '($11 > 5400) {print "/usr/sbin/asterisk -rx \"soft hangup " $1 "\""} '|sh

perl -e 'print $i=pack(c5,(40*2),sqrt(7600),(unpack(c,Q)-3+1+3+3-7),oct(104),10,oct(101));'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top