Sponsored Content
Top Forums Shell Programming and Scripting Shell script to run command + compare values and post a warning message. Post 302540488 by Mr_47 on Wednesday 20th of July 2011 11:16:17 PM
Old 07-21-2011
Shell script to run command + compare values and post a warning message.

Hi all,

I am trying to create shell script to run command then compare values with rule set for every 5 seconds and post a warning message if the compared value meet the rules.

-the script is related to Oracle/Sun product messaging server 6.2

1) command that need to be run to gather required data for comparison.
/msg2/SUNWmsgsr/sbin -------path to run the command.
./counterutil -o httpstat -------------------------------->this is the command.
Monitor counteroobject (httpstat)
registry /msg2/SUNWmsgsr/data/counter/counter opened
counterobject httpstat opened

count = 1 at 1311142834 rh = 0x4fbf0 oh = 0x4fc18

global.currentstarttime [4 bytes]: 13/May/2011:18:03:04 +0800
global.lastconnectiontime [4 bytes]: 20/Jul/2011:14:20:34 +0800
global.maxconnections [4 bytes]: 931
global.numconnections [4 bytes]: 19272174
global.numcurrentconnections [4 bytes]: 7
global.numcurrentsessions [4 bytes]: 1565 ----> I need to collect this data only
global.numfailedconnections [4 bytes]: 0
global.numfailedlogins [4 bytes]: 10208
global.numgoodlogins [4 bytes]: 2189068

2) compare collected data with rule set.
compare the collected data for every 5 seconds with rule set
-rule details,

if collected data >5800
the server will show popup message or sent the warning to administrator email or something to alert the admin(any idea guys?) : alert message: "Warning current session reaching maximum limit"
else
continue compare
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

script to run shell command and insert results to existing xml file

Hi. Thanks for any help with this. I'm not new to programming but I am new to shell programming. I need a script that will 1. execute 'df -k' and return the volume names with specific text 2. surround each line of the above results in opening and closing xml tags 3. insert the results of step... (5 Replies)
Discussion started by: littlejon
5 Replies

2. Shell Programming and Scripting

Execute a shell script after a particular command is run

Hi, I need to run a script whenever the Cron file is modified. The requirement is whenever a user modifies the cron file, the script should run automatically. Can you please provide your inputs ? (5 Replies)
Discussion started by: harneet2004us
5 Replies

3. Shell Programming and Scripting

How to compare version values in shell script?

Hi, I need to compare two versions values and report only true or false depending on their difference result. like - echo $(echo "1.8 >= 2.0" | bc) 0 echo $(echo "2.0 >= 2.0" | bc) 1 but my task is to compare values like - echo $(echo "1.9.1 >= 2.0" | bc) (standard_in) 1: syntax... (3 Replies)
Discussion started by: abhitanshu
3 Replies

4. Shell Programming and Scripting

run command in a script shell

Hello, Please i'd like to run command in a script shell , how can i do ? here my commands : cd blcr-build // run command in this rep sudo insmod ./blcr_imports/kbuild/blcr_imports.ko //root sudo insmod ./cr_module/kbuild/blcr.ko //root Thank you. (1 Reply)
Discussion started by: chercheur857
1 Replies

5. Shell Programming and Scripting

Help me!how to run autosys command in UNIX shell script

Hi all, Here is my scenario.. i need to get dates from an existing autosys calendar and compare it with current date with in a unix shell script. Please help me out and give me an approach to handle this....... the general autosys calendar command used is autocal_asc ,but this is... (1 Reply)
Discussion started by: shrik12345
1 Replies

6. Shell Programming and Scripting

Help with shell script to compare values between servers

Hi I am a beginner in UNIX and shell scripting and i have a requirement as stated below, requirement Login to a unix server 1 1. connect to a database mysql -uUsername -pPassword 2. Select a Schema : "Use Schemaname1" 3. query for a particular record ... (2 Replies)
Discussion started by: Hamdul
2 Replies

7. Shell Programming and Scripting

Issues while trying to run a shell script using the command sh <filename.prog>

Hi, I'm facing issues while trying to run a sample program on Linux. If I try to run the script using the command "sh <filename.prog>", it doesn't work. But, if I try to execute it using the command "ksh <filename.prog>", it works fine. Even ". ./filename.prog" works fine. Can you... (6 Replies)
Discussion started by: venkatesh17
6 Replies

8. Shell Programming and Scripting

I am getting strange message when run borne shell script

I have a code: if then#{ process daily files for file in *_${Today}*.csv *_${Today}*.txt do if || then echo "This file will be processed in separate script" continue fi if ;then ... (2 Replies)
Discussion started by: digioleg54
2 Replies

9. Shell Programming and Scripting

Shell Script run curl command calling cyber-Ark RESTAPI

Hi All, We have a requirement to Integrate Cyber-Ark with Informatica . Basically cyberark will contain the username and password for Database. First step will be 1)In shell Script run curl command calling cyber-Ark RESTAPI requesting the credentials and store the secret in a variable. ... (0 Replies)
Discussion started by: Praveena9102
0 Replies

10. Shell Programming and Scripting

Replace string works on command-line but fails when run from shell script

I wish to replace "\\n" with a single white space. The below does the job on command-line: $ echo '/fin/app/scripts\\n/fin/app/01/sql' | sed -e 's#\\\\n# #g'; /fin/app/scripts /fin/app/01/sql However, when i have the same code to a shell script it is not able to get me the same output:... (8 Replies)
Discussion started by: mohtashims
8 Replies
READ(5) 							File Formats Manual							   READ(5)

NAME
read, write - transfer data from and to a file SYNOPSIS
Tread tag[2] fid[2] offset[8] count[2] Rread tag[2] fid[2] count[2] pad[1] data[count] Twrite tag[2] fid[2] offset[8] count[2] pad[1] data[count] Rwrite tag[2] fid[2] count[2] DESCRIPTION
The read request asks for count bytes of data from the file identified by fid, which must be opened for reading, starting offset bytes after the beginning of the file. Count must be less than or equal to MAXFDATA (8192, defined in <fcall.h>). The bytes are returned with the read reply message. The count field in the reply indicates the number of bytes returned. This may be less than the requested amount. If the offset field is greater than the number of bytes in the file, a count of zero will be returned. For directories, read returns an integral number of direc- tory entries exactly as in stat (see stat(5)), one for each member of the directory. The read request message must have offset and count zero modulo DIRLEN. The write request asks that count bytes of data be recorded in the file identified by fid, which must be opened for writing, starting off- set bytes after the beginning of the file. If the file has been opened append only, the data will be placed at the end of the file regard- less of offset. Directories may not be written. The write reply records the number of bytes actually written. It is usually an error if this is not the same as requested. ENTRY POINTS
Read and write messages are generated by the corresponding calls. Because of the MAXFDATA limit, more than one message may be produced by a single call. READ(5)
All times are GMT -4. The time now is 04:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy