Help with Swapinfo automation Alert script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help with Swapinfo automation Alert script
# 1  
Old 12-27-2010
Tools Help with Swapinfo automation Alert script

I am new to unix scripting (HP-UX) and need to write a script for checking memory usage.

I am using "ipcs -ma" and using "awk" to select specific colums and redirecting output to variable.
Code:
/usr/bin/ipcs -ma | awk '{ print $5,$10,$12}' > $TMP_FILE

exec < $TMP_FILE
while read line;
do
   OWNER=`echo $line | awk -F '' '{print $1}'`
   SEGSZ=`echo $line | awk -F '' '{print $2}'`
   LPID=`echo $line | awk -F '' '{print $3}'`

However, seems the value of $OWNER is $5,$10,$12 and $SEGSZ / $LPID are empty. Based on what I have, is there something I'm doing wrong for this to happen?


Moderator's Comments:
Mod Comment Please use code tags when posting data and code samples, thank you.

Last edited by Franklin52; 12-29-2010 at 06:00 PM.. Reason: Code tags
# 2  
Old 12-29-2010
Resolved

I was able to resolve the issue by codeing the following instead:

Code:
OWNER=`echo $line | awk '{print $1}'`
SEGSZ=`echo $line | awk '{print $3}'`
CPID=`echo $line | awk '{print $4}'`

it worked! Smilie

Last edited by Franklin52; 12-29-2010 at 06:01 PM.. Reason: code tags
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Automation Script for Oracle

Hi, As a Oracle Developer, I am writing many Procedures,Functions and Packages. Facing Many optimization issue after writing these Database objects. Trying to tune it manually. Can we write any Shell/Perl/Python script to Optimize these Database objects instead of doing manual check and... (1 Reply)
Discussion started by: vasuvv
1 Replies

2. UNIX for Beginners Questions & Answers

Automation script for email alert when a job get complete with status successful.

Guyz, Please let me know about script which is to be sending an automatic email to particular mail id's when a monotoring job get complete with status successful. (1 Reply)
Discussion started by: Rehan Ahmad
1 Replies

3. Shell Programming and Scripting

Automation script

Hello All , I came across a tricky solution to devolop . Here is a part of the requirement automation . I have different set of server say : Web ( has 4 servers under it ) , App ( has 4 servers under it ) , DB ( has 2 servers under it ) Above each i have different load balancers , Say : Web... (4 Replies)
Discussion started by: radha254
4 Replies

4. Shell Programming and Scripting

Script to automation utility app

Hi All, Am trying to write a shell script to automate one of the product utility but am struck with how to send/key in the inputs and most importantly it requires to press "Enter" key every time after giving the input. Not sure how to take control of utility from script and key in... (1 Reply)
Discussion started by: Optimus81
1 Replies

5. Shell Programming and Scripting

awk script automation

I have the below code which calculates the time difference between src and dst from a large trace file. The code works for a given source and destination. However, I want to automate the code to go over any src and destination. The format of the source is like that: X.Y where x is always =2 and Y... (10 Replies)
Discussion started by: ENG_MOHD
10 Replies

6. Shell Programming and Scripting

Script Automation

Hi Gurus, I have a clearcase script that i use to check in a single file at time on my clearcase server. the script is as follows setmyview settask 75098_MSI_TRILOGY_EIM cd /vobs/Trilogy_R12/custom/msieim/12.0.0/sql/ cleartool co -nc . ct mkelem -nc Filename_1.sql cp... (3 Replies)
Discussion started by: r_t_1601
3 Replies

7. Shell Programming and Scripting

Script For Folder Management Automation

Let me start off by saying I am not a linux guy nor do I script much (I modify scripts a bit) but I am looking for a code to help automate file management on usb sticks with clonezilla images. I'm looking for a script to recognize folder names and allow a max of 2 folders with the same text in... (6 Replies)
Discussion started by: traustic
6 Replies

8. Shell Programming and Scripting

Help with Shell Script automation

can someone look into this one please... I am struck at this point. I do not know what logic to be followed here. I can go ahead with my work only, if this step is done. Please Help. I have a process X in a shell script. Once the process X is done, it generates a log file. Process X is basically... (1 Reply)
Discussion started by: ss3944
1 Replies

9. Shell Programming and Scripting

FTP automation script

Hi, I have got a requirement like this. a parameterized function custFtp which will take 5 i/ps and will do the following tasks. p1) server name p2) username p3) password p4) path name of the server where the file resides p5) file name pattern the function will work like this. ... (1 Reply)
Discussion started by: ani_datta
1 Replies

10. HP-UX

swapinfo question

Hi All, Here is output of swapinfo -t from a server which has been giving TNS-00519: Operating system resource quota exceeded HPUX Error: 12: Not enough space The server has been stable for 7 days now since some more swap space was added. 2 questions 1. Will the above error occur... (2 Replies)
Discussion started by: mat_cottrell
2 Replies
Login or Register to Ask a Question