- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- A script help for cat top information
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2002 07:12 PM
05-06-2002 07:12 PM
We want to monitor top info about every 5 mins.
in hp-ux, top command will give info like this:
System: gbm2 Tue May 7 11:09:21 2002
Load averages: 1.86, 1.99, 2.23
599 processes: 590 sleeping, 9 running
Cpu states:
CPU LOAD USER NICE SYS IDLE BLOCK SWAIT INTR SSYS
0 2.10 73.2% 0.0% 10.4% 16.3% 0.0% 0.0% 0.0% 0.0%
1 1.92 69.1% 0.0% 12.6% 18.3% 0.0% 0.0% 0.0% 0.0%
2 1.45 60.4% 0.0% 13.6% 26.0% 0.0% 0.0% 0.0% 0.0%
3 1.98 75.6% 0.0% 5.5% 18.9% 0.0% 0.0% 0.0% 0.0%
--- ---- ----- ----- ----- ----- ----- ----- ----- -----
avg 1.86 69.7% 0.0% 10.4% 19.9% 0.0% 0.0% 0.0% 0.0%
Memory: 4234240K (1405072K) real, 3909564K (1203124K) virtual, 1066808K free Pa
ge# 1/67
CPU TTY PID USERNAME PRI NI SIZE RES STATE TIME %WCPU %CPU COMMAND
0 ? 25550 erpmgr 235 20 27240K 10960K run 0:07 19.26 19.23 f60webmx
2 ? 10798 erpmgr 148 20 48376K 34240K sleep 1:49 14.18 14.16 f60webmx
1 ? 25116 erpmgr 154 20 32504K 16600K sleep 0:13 9.06 9.05 f60webmx
0 ? 10638 oraerp 148 20 34596K 6144K sleep 0:52 8.96 8.95 oraclePR
2 ? 21403 erpmgr 154 20 33176K 17460K sleep 0:29 8.76 8.74 f60webmx
2 ? 13572 erpmgr 216 20 39560K 24264K run 2:59 8.24 8.22 f60webmx
2 pts/ta 25801 oraerp 154 20 1056K 2852K sleep 0:02 21.80 7.90 vi
1 ? 25252 erpmgr 154 20 28904K 13536K sleep 0:07 7.01 6.99 f60webm
Please help me how to print 1st , 11th and 13th lines,
like this:
System: gbm2 Tue May 7 11:09:21 2002
avg 1.86 69.7% 0.0% 10.4% 19.9% 0.0% 0.0% 0.0% 0.0%
Memory: 4234240K (1405072K) real, 3909564K (1203124K) virtual, 1066808K free Page# 1/67
Thanks again.
Violin.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2002 07:22 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2002 07:26 PM
05-06-2002 07:26 PM
Re: A script help for cat top information
while true
do
top -d 1 | egrep 'Memory|System'
sleep 10
clear
done

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2002 07:29 PM
05-06-2002 07:29 PM
Re: A script help for cat top information
egrep 'Memory|System|avg'

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2002 07:51 PM
05-06-2002 07:51 PM
Re: A script help for cat top information
#!/bin/sh
top -f /tmp/top.out
echo " ========================="
grep ^Memory /tmp/top.out
grep ^avg /tmp/top.out
echo " ============================"
# End
-Niraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2002 07:53 PM
05-06-2002 07:53 PM
Re: A script help for cat top information
Cheers John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2002 08:19 PM
05-06-2002 08:19 PM
Re: A script help for cat top information
Thanks for your reply.
I try to edit a shell like this:
#!/bin/sh
while true
do
echo "-----------------------"
top -d 1 | egrep 'Memory|System|avg'
sleep 10
clear
done
And then try run and spool to log:
. top5 >> top5.log
But the top5.log is :
[?25h [m [H [J 7 [1;24r 8 [4lSystem: gbm2 [42CTue May 7 12:20:33 2002
avg 0.40 2.0% 0.0% 1.0% 97.0% 0.0% 0.0% 0.0% 0.0%
Memory: 3365496K (621808K) real, 3140932K (575240K) virtual, 1940580K free Page
[H [J-------------------------------------------------
[?25h [m [H [J 7 [1;24r 8 [4lSystem: gbm2 [42CTue May 7 12:20:44 2002
avg 0.37 23.0% 0.0% 19.0% 58.0% 0.0% 0.0% 0.0% 0.0%
Memory: 3365992K (560664K) real, 3142028K (506684K) virtual, 1940036K free Page
Can you teach me how to discard those marks?
[m,[H......
Thanks again.
Violin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2002 08:43 PM
05-06-2002 08:43 PM
Re: A script help for cat top information
#!/bin/sh
while true
do
echo "-----------------------"
top -f top.out
cat top.out |egrep '^Memory|^System|^avg'
sleep 10
clear
done
-Niraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2002 09:29 PM
05-06-2002 09:29 PM
Re: A script help for cat top information
your script really works,
but another question again,
IF I want to execute this script after boot,
how can I do for this?
Sorry I'm not so familiar with HP-UX.
Thanks again.
Violin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2002 09:49 PM
05-06-2002 09:49 PM
Re: A script help for cat top information
/sbin/init.d/*
and proper link to respective rc directory
.
-Niraj