If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Linux shell script

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-18-11, 05:03
blazer789 blazer789 is offline
Registered User
 
Join Date: Jun 2009
Posts: 221
Linux shell script

Can some one give me a script where it determine if a process is running for more than 15 minutes.

The process name is file_system_check.ksh

If I do a ps -ef | grep -i file_system_check.ksh | grep -v grep, this process filters out.

The logic which I need to present in the script is, If the above process is running for more than 15 minutes, then it needs to send an email saying that the process is running for more than 15 minutes.
Reply With Quote
  #2 (permalink)  
Old 02-18-11, 09:05
nvk@vhv nvk@vhv is offline
Registered User
 
Join Date: Jan 2010
Posts: 294
Hi Blazer,

since your script is for an database-Server i'ld work with DB2-Timestamps. It's easier than doing the Math with dates from the Shell or system.

At the start of your check-script write the current timestamp into a file:
db2 -x "values (current timestamp)" > some/file.out // Database-Connection required!

If you want to test your file_system_check.ksh,
then

START_TIME=$(cat some/file.out)
CHECK_TIME=$(db2 -x "values (current timestamp - $RUNTIME minutes)" )

if [[ $CHECK_TIME > $START_TIME ]]; then
mailx -s bla mail@address.com ...
fi

Hth
nvk
Reply With Quote
  #3 (permalink)  
Old 02-23-11, 01:45
blazer789 blazer789 is offline
Registered User
 
Join Date: Jun 2009
Posts: 221
Thanks NVK
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On