Sponsored Content
Top Forums Shell Programming and Scripting How to check the status of script for every 5 min? Post 302866399 by heman96 on Tuesday 22nd of October 2013 12:39:03 AM
Old 10-22-2013
Trap

Hi Guys ...

Need help

HTML Code:
$ cat trap.sh
#!/bin/bash
trap cleanup 1 2 3 15
cleanup()
{
echo “I was running \”$BASH_COMMAND\” when you interrupted me.”
echo “Quitting.”
exit 1
}
while :
do
echo -en “hello. “
sleep 1
echo -en “my “
sleep 1
echo -en “name “
sleep 1
echo -en “is “
sleep 1
echo “$0”
done
Can anyone guess why "1 2 3 15" is need as argument to cleanup function ?

Thanks
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

how to check exit status in awk script

Hi, I have a main program which have below lines - awk -f test.awk inputFileName - I wonder how to check status return from awk script. content of awk script: test.awk --- if ( pass validation ) { exit 1 } else { (1 Reply)
Discussion started by: epall
1 Replies

2. Shell Programming and Scripting

Script to check status of a PID

i'm just learning scripting, and have been banging my head against this I want to check if my WAS6 java process is running and if so..echo me a messages. If not then echo me a different messages the problem i have is I dont know how to represent a NULL return value. If i grep for a was6... (14 Replies)
Discussion started by: zeekblack
14 Replies

3. Shell Programming and Scripting

check exit status - Expect Script

from my main script, i am calling an expect script. there are a lot of conditions in the Expect script and it can have any exit value based on success or failure of the Expect Script. how can i check the exit status of Expect scritp in the main script. (1 Reply)
Discussion started by: iamcool
1 Replies

4. UNIX for Dummies Questions & Answers

unix script to check if rsh to box and send status mail

rshstatus=`rsh -n lilo /db/p2/oracle/names9208/restart_names.sh` if $rshstatus <>0 then errstatus=1 mailx -s "xirsol8dr" ordba@xxx.com >> $log_dr else if errstatus=0 echo "status to xirsol8dr successful" can anyone provide if this is t he correct way to do this or is there a better way? (1 Reply)
Discussion started by: bpm12
1 Replies

5. UNIX for Dummies Questions & Answers

SFTP script - poll every min to check file complete before transfering

Hello, Before I do a GET remote file, I need to ensure the remote file is a complete file i.e. whatever process is saving the file to the remote folder should complete the transfer before I go GET it through my script. So I'm thinking I need to poll the remote file every minute or so to... (4 Replies)
Discussion started by: srineel
4 Replies

6. Shell Programming and Scripting

Automation, Copy, File Status Check --> Script(s)

All, I have to write a script to do the following requirement. There is a file called BUSINESS_DATE.TXT. This file get updated once the oracle partition created. In Oracle, Partition will be created every day. There is a seperate script scheduled to take care ORACLE partition creation. The... (3 Replies)
Discussion started by: karthi_mrkg
3 Replies

7. Shell Programming and Scripting

Help....script check status if see something then send email

autorep -m bogus Machine Name Max Load Current Load Factor O/S Status ___________ ________ ___________ ______ ________ ______ bogus --- --- 1.00 Sys Agent Online Status ______ Online Offline Missing Unqualified The "Status" always "Online". I like create a script execute run... (6 Replies)
Discussion started by: dotran
6 Replies

8. Linux

Check up the status of a Script (running or not)

Hello, i allready search on google und here in the local Forum, but can't found something. I need a query in php, that check whether a process (script) is running or not. Like this: php query: /usr/bin/Script01 >> if runnig, then: "Script01 is Online", if not "Script01 is Offline" I... (2 Replies)
Discussion started by: ProTechEx
2 Replies

9. Shell Programming and Scripting

UNIX script to check multiple jobs runninng status

Hi Folks, Please help me ,I need a unix shell script to check for multiple jobs running. if there are multiple backup Jobs running then it should be trigger an email . Thanks, Anand T (1 Reply)
Discussion started by: nandu67
1 Replies

10. Shell Programming and Scripting

Script to check process status

Hi Team, I am using redhat 6.4 version server.We have a script which is used to check the process and sends email if the process is not running.If it is running it will continue and do some other operation. I didnot understand below option -z in the if condition.I have tried to... (5 Replies)
Discussion started by: muraliinfy04
5 Replies
TIME_NANOSLEEP(3)							 1							 TIME_NANOSLEEP(3)

time_nanosleep - Delay for a number of seconds and nanoseconds

SYNOPSIS
mixed time_nanosleep (int $seconds, int $nanoseconds) DESCRIPTION
Delays program execution for the given number of $seconds and $nanoseconds. PARAMETERS
o $seconds - Must be a non-negative integer. o $nanoseconds - Must be a non-negative integer less than 1 billion. RETURN VALUES
Returns TRUE on success or FALSE on failure. If the delay was interrupted by a signal, an associative array will be returned with the components: o seconds - number of seconds remaining in the delay o nanoseconds - number of nanoseconds remaining in the delay CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 5.3.0 | | | | | | | This function is now available on Windows plat- | | | forms. | | | | +--------+---------------------------------------------------+ EXAMPLES
Example #1 time_nanosleep(3) example <?php // Careful! This won't work as expected if an array is returned if (time_nanosleep(0, 500000000)) { echo "Slept for half a second. "; } // This is better: if (time_nanosleep(0, 500000000) === true) { echo "Slept for half a second. "; } // And this is the best: $nano = time_nanosleep(2, 100000); if ($nano === true) { echo "Slept for 2 seconds, 100 microseconds. "; } elseif ($nano === false) { echo "Sleeping failed. "; } elseif (is_array($nano)) { $seconds = $nano['seconds']; $nanoseconds = $nano['nanoseconds']; echo "Interrupted by a signal. "; echo "Time remaining: $seconds seconds, $nanoseconds nanoseconds."; } ?> SEE ALSO
sleep(3), usleep(3), time_sleep_until(3), set_time_limit(3). PHP Documentation Group TIME_NANOSLEEP(3)
All times are GMT -4. The time now is 09:49 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy