Sponsored Content
Top Forums Shell Programming and Scripting script to list out the output in one paragraph Post 302208773 by fara_aris on Wednesday 25th of June 2008 01:11:21 AM
Old 06-25-2008
script to list out the output in one paragraph

Hi All,
I want to run 5 `ps -ef | grep [process]` cmds in one script and i want the script to give me return code 0 if everything is OK. If it notices one of the processes is not there, it will prompt me the process name and advice me to check it.

I've wrote a script that separates the output but I want to combine it into one output.

echo "\n***------------------------------***"
echo "\nNo. 8"
echo "To check WAS-server1 process.."
varB=`ps -ef | grep server1`
if [ $? -eq 0 ]
then
echo "OK, WAS-server1 process is up."
else
echo "==>NOT OK; WAS-server1 PROCESS IS DOWN, please check!!"
fi
sleep 3

echo "\n***------------------------------***"
echo "\nNo. 9"
echo "To check tws process.."
varC=`ps -ef | grep tws`
if [ $? -eq 0 ]
then
echo "OK, tws processes are up."
else
echo "==>NOT OK; tws PROCESS IS DOWN, please check!!"
fi
sleep 3


And the output is;
No. 8
To check WAS-server1 process..
OK, WAS-server1 process is up.

***------------------------------***

No. 9
To check tws process..
OK, tws processes are up.


I want the output to be like this;
(If all processes are up)
Checking all processes..
Return code : 0
All processes are up, OK.

(If one of the processes in not up)
Checking all processes..
WAS-server1 is UP, OK.
==> TWS is not UP, PLEASE CHECK!!



Please help, thank you.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bold the paragraph

Hi, I have a file with multiple paragraph. I want to look for some word and make that paragraph bold. How can I do that? Thanks, Karthik (3 Replies)
Discussion started by: caprikar
3 Replies

2. Shell Programming and Scripting

script for a 3 line paragraph

i would like to ask how to make a script that in evry 3 lines of my paragraph(below) it would appear like this: $ cat myparagraph this is line 1 this is line 2 this is line3 this is line 4 this is 5 this 6 this is 7 this 8 ==================================================== $ cat... (2 Replies)
Discussion started by: invinzin21
2 Replies

3. UNIX for Dummies Questions & Answers

Split a paragraph

Hi, Consider the following paragraph. This is line1. This is line2, This is last line. I need the output as 4:This is last line. i.e The line after the blank line should be displayed along with line number. I am a unix begineer.Any one please help me to solve this problem (3 Replies)
Discussion started by: Sekar1
3 Replies

4. Shell Programming and Scripting

Need your HELP:: Shell script to detect paragraph in coordinate-based code.

Hi Friends!! I have obtained following output from a tool called pdftoxml: <xml> <text top="423" left="521" width="333" height="20" font="3">Although the the number of fuzzy rules of a system is </text> <text top="441" left="500" width="355" height="20" font="3">directly dependant on these... (2 Replies)
Discussion started by: parshant_bvcoe
2 Replies

5. Shell Programming and Scripting

I need a script to find socials in files and output a list of those files

I am trying to find socail security numbers in files in (and under) a specific directory and output a list of the files where they are found... the format would be with no dashes just 9 numeric characters in a row. I have tried this: find /DirToLookIn -exec grep '\{9\}' /dev/null {} \; >>... (1 Reply)
Discussion started by: NewSolarisAdmin
1 Replies

6. UNIX for Dummies Questions & Answers

Output text from 1st paragraph in file w/ a specific string through last paragraph of file w/ string

Hi, I'm trying to output all text from the first paragraph in a file that contains a specific string through the last paragraph in that file that contains that string. Previously, I was outputting just each paragraph with that search string with: cat in_file | nawk '{RS=""; FS="\n";... (2 Replies)
Discussion started by: carpenn
2 Replies

7. Shell Programming and Scripting

Awk script to run a sql and print the output to an output file

Hi All, I have around 900 Select Sql's which I would like to run in an awk script and print the output of those sql's in an txt file. Can you anyone pls let me know how do I do it and execute the awk script? Thanks. (4 Replies)
Discussion started by: adept
4 Replies

8. Shell Programming and Scripting

script to mail monitoring output if required or redirect output to log file

Below script perfectly works, giving below mail output. BUT, I want to make the script mail only if there are any D-Defined/T-Transition/B-Broken State WPARs and also to copy the output generated during monitoring to a temporary log file, which gets cleaned up every week. Need suggestions. ... (4 Replies)
Discussion started by: aix_admin_007
4 Replies

9. Shell Programming and Scripting

Bash script to extract paragraph with globs in it

Hi, Its been a long time since I have used Bash to write a script so am really struggling here. Need the gurus to help me out. uname -a Linux lxserv01 2.6.18-417.el5 i have a text file with blocks of code written in a similar manner ******* BEGIN MESSAGE ******* Station /... (12 Replies)
Discussion started by: dsid
12 Replies

10. UNIX for Beginners Questions & Answers

Need list of input and output parameter of task in a text file, using shell script

//file begin ===== //some code task abcd_; input x; input y,z; //some comment output w; //some comment reg p; integer q; begin //some code end endtask : abcd_ //some code //file end ===== expected output from above... (1 Reply)
Discussion started by: rishifrnds
1 Replies
TWS(4)							   BSD Kernel Interfaces Manual 						    TWS(4)

NAME
tws -- 3ware 9750 SATA+SAS 6Gb/s RAID controller card driver SYNOPSIS
To compile this driver into the kernel, place the following lines in your kernel configuration file: device scbus device tws Alternatively, to load the driver as a module at boot time, place the following line in loader.conf(5): tws_load="YES" DESCRIPTION
The tws driver provides support for LSI's 3ware 9750 SATA+SAS 6Gb/s RAID controller cards. These controllers feature the LSISAS2108 6Gb/s SAS RAID-on-Chip (ROC) and are available in 4- and 8-port configurations, supports RAID levels 0, 1, 5, 6, 10, 50 and single disk, with 96 SATA and/or SAS hard drives and SSDs. For further hardware information, see http://www.lsi.com/. HARDWARE
The tws driver supports the following SATA/SAS RAID controller: o LSI's 3ware SAS 9750 series LOADER TUNABLES
Tunables can be set at the loader(8) prompt before booting the kernel or stored in loader.conf(5). hw.tws.cam_depth The maximum queued CAM SIM requests for one controller. The default value is 256. hw.tws.enable_msi This tunable enables MSI support on the controller if set to a non-zero value. The default value is 0. hw.tws.queue_depth The maximum queued requests for one controller. hw.tws.use_32bit_sgls Limit the driver to use only 32-bit SG elements regardless whether the operating system is running in 64-bit mode. The default value is 0. FILES
/dev/da? array/logical disk interface /dev/tws? management interface DIAGNOSTICS
Whenever the driver encounters a command failure, it prints out an error code in the format: "ERROR: (<error source>: <error code>):", fol- lowed by a text description of the error. There are other error messages and warnings that the driver prints out, depending on the kinds of errors that it encounters. If the driver is compiled with TWS_DEBUG defined, it prints out a whole bunch of debug messages. SEE ALSO
da(4), scsi(4) AUTHORS
The tws driver was written by Manjunath Ranganathaiah for LSI and this manual page was written by Xin LI <delphij@FreeBSD.org> for iXsystems, Inc. BSD
October 4, 2011 BSD
All times are GMT -4. The time now is 09:28 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy