Sponsored Content
Full Discussion: Monitor Memory of a process
Top Forums UNIX for Dummies Questions & Answers Monitor Memory of a process Post 302335257 by DeCoTwc on Saturday 18th of July 2009 01:57:46 AM
Old 07-18-2009
This is something I through together once when I had to do something similar. (Actually at the time it was a one liner, but I'm really bored at the moment, so I played around)

Code:
(01:40:26+deco@DeCoBuntu)
[~]$cat track
#!/bin/bash
if [[ -z $1 ]];then
echo "Usage: `basename $0` <process to watch> <delay between checks>"
echo "If Delay not specified, default is 5 seconds"
exit
fi

usage=`top -b1 -n1|grep -i $1|awk '{print $10}'`
while true
do 
echo -ne "$1 is using $usage percent of the total memory"
echo -ne "\r"
if [[ -n $2 ]];then
sleep $2
else
sleep 5
fi
usage=`top -b1 -n1|grep -i $1|awk '{print $10}'`
done
(01:42:10+deco@DeCoBuntu)
[~]$./track
Usage: track <process to watch> <delay between checks>
If Delay not specified, default is 5 seconds
(01:45:45+deco@DeCoBuntu)
[~]$./track firefox 2
firefox is using 16.5 percent of the total memory

I'm pretty certain the switches on top could be done better, but honestly, I'm not very good at this kind of thing.
 

10 More Discussions You Might Find Interesting

1. HP-UX

monitor memory usuage

Hi, We have HP-UX 11.23 and i want to use glance utility to monitor the memory usuage. Can someone tell me how to sort by memory usuage in glance utility? Thx (1 Reply)
Discussion started by: rockcapri
1 Replies

2. Shell Programming and Scripting

script to monitor process running on server and posting a mail if any process is dead

Hello all, I would be happy if any one could help me with a shell script that would determine all the processes running on a Unix server and post a mail if any of the process is not running or aborted. Thanks in advance Regards, pradeep kulkarni. :mad: (13 Replies)
Discussion started by: pradeepmacha
13 Replies

3. UNIX for Advanced & Expert Users

How often should I monitor the CPU and memory usage ?

Hi all, When you monitor the CPU and memory usage, how often do you do it ? Do it too often or too rarely will both cause the problem. So does anyone have hand-on experience ? And for my case, the requirement says that when CPU usage is above X% or memory usage is above Y%, I should reject... (5 Replies)
Discussion started by: qiulang
5 Replies

4. Emergency UNIX and Linux Support

How to monitor a process memory utilization?

hi frnds, I want to monitor a particular process very closly on how much memory it is taking. i tried with TOP and PRSTAT commands that is not giving what exactly i need. In my application, there is a memory leak happening, i want to know when it is occuering, means which transcation is... (9 Replies)
Discussion started by: vij_krr
9 Replies

5. Shell Programming and Scripting

script to monitor the process system when a process from user takes longer than 15 min run.

get email notification from from system when a process from XXXX user takes longer than 15 min run.Let me know the time estimation for the same. hi ,any one please tell me , how to write a script to get email notification from system when a process from as mentioned above a xxxx user takes... (1 Reply)
Discussion started by: kirankrishna3
1 Replies

6. Linux

Monitor memory

Suppose our application limit use for up to 20GB of data. How to monitor the usage? Do we need to consider swap? Thanks. (2 Replies)
Discussion started by: zhshqzyc
2 Replies

7. UNIX for Dummies Questions & Answers

What to monitor for memory usage?

hi guys I am having a doubt about memory monitoring on linux system what I should be monitoring? memory usage? o swap usage? I am using some monitoring tools but I am confused to what monitor for alerting for example this case looks the memory usage is very high and it's like that all... (2 Replies)
Discussion started by: karlochacon
2 Replies

8. AIX

Script to monitor CPU , Memory

Hello. I am using AIX 6 and did lot of searches on google for this script and found so many results. Just thought to ask you being the real good place for centralised answer: a) Could you tell me the aix script, which may tell me If the CPU load is above e.g. 60% ? b) Could you tell me the AIX... (2 Replies)
Discussion started by: panchpan
2 Replies

9. Solaris

[DOUBT] Memory high in idle process on Solaris 10 (Memory Utilization > 90%)

Hi Experts, Our servers running Solaris 10 with SAP Application. The memory utilization always >90%, but the process on SAP is too less even nothing. Why memory utilization on solaris always looks high? I have statement about memory on solaris, is this true: Memory in solaris is used for... (4 Replies)
Discussion started by: edydsuranta
4 Replies

10. Red Hat

Best way to monitor use of memory resources for an RHEL instance

I wanted to know what is the best way to monitor use of memory on an RHEL server. We have 16 GB of memory for the RHEL instance but the usage at any time is more than 99%. I use /proc/meminfo on the server to check memory. I hope, my question is clear that what is the best way to monitor use of... (2 Replies)
Discussion started by: RHCE
2 Replies
deco(6x)							XScreenSaver manual							  deco(6x)

NAME
deco - draw tacky 70s basement wall panelling SYNOPSIS
deco [-display host:display.screen] [-foreground color] [-background color] [-window] [-root] [-mono] [-install] [-visual visual] [-delay seconds] [-max-depth int] [-min-width int] [-min-height int] [-line-width yIint] [-smooth-colors] [-golden-ratio] [-mondrian] [-fps] DESCRIPTION
The deco program subdivides and colors rectangles randomly. It looks kind of like Brady-Bunch-era rec-room wall paneling. (Raven says: "This screensaver is ugly enough to peel paint.") Can also produce more aesthetically pleasing displays via options. OPTIONS
deco accepts the following options: -window Draw on a newly-created window. This is the default. -root Draw on the root window. -mono If on a color display, pretend we're on a monochrome display. -install Install a private colormap for the window. -visual visual Specify which visual to use. Legal values are the name of a visual class, or the id number (decimal or hex) of a specific visual. -delay seconds How long to wait before starting over. Default 5 seconds. -max-depth integer How deep to subdivide. Default 12. -min-width integer -min-height integer The size of the smallest rectangle to draw. Default 20x20. -line-width integer Width of lines drawn between rectangles. Default zero (minimal width). -smooth-colors -no-smooth-colors Whether to use a smooth color palette instead of a random one. Less jarring. Default False. -golden-ratio -no-golden-ratio Whether to subdivide rectangles using the golden ratio instead of 1/2. This ratio is supposed to be more aesthetically pleasing. Default false. -mondrian -no-mondrian Whether to imitiate style of some famous paintings by Piet Mondrian. Overrides line-width and colormap options. Default false. -fps Display the current frame rate and CPU load. ENVIRONMENT
DISPLAY to get the default host and display number. XENVIRONMENT to get the name of a resource file that overrides the global resources stored in the RESOURCE_MANAGER property. SEE ALSO
X(1), xscreensaver(1) COPYRIGHT
Copyright (C) 1997 by Jamie Zawinski. Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. No representations are made about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. AUTHOR
Jamie Zawinski <jwz@jwz.org>, 26-Apr-97, based on code by Michael D. Bayne <mdb@go2net.com>. Golden ratio and Mondrian settings by Lars Huttar. X Version 11 5.15 (28-Sep-2011) deco(6x)
All times are GMT -4. The time now is 05:30 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy