If the "top" command shows the correct result you can just use something like this:
top -b -n 1 | grep apache
Check "man top" for more information. I'm basically starting top in batch mode and running it for a single iteration.
You probably cheched this, but note that if the webpage loop is client-side your server will not get hurt.
Linux "ps" command
i tried this command, and it shows a list of apache processes running at 0.0, and one of them at 0.1.
actually apache doesn't need any resources, unless you really have a big server load. so a CPU load of 0.0 seems ok to me (and if i run top, apache is so far at the bottom, that i cant see it).
but you can test your command like this: start a find to list all files; this eats a lot of CPU/IO:
find /
open another terminal and enter
ps -eo "%cpu %C %U %c %a" | grep find
gives me:
4.0 find pu 4.0 chris find find /
seems to work!
Chris
actually apache doesn't need any resources, unless you really have a big server load. so a CPU load of 0.0 seems ok to me (and if i run top, apache is so far at the bottom, that i cant see it).
but you can test your command like this: start a find to list all files; this eats a lot of CPU/IO:
find /
open another terminal and enter
ps -eo "%cpu %C %U %c %a" | grep find
gives me:
4.0 find pu 4.0 chris find find /
seems to work!
Chris
What about ps axu followed by | grep whatever?
tyler@localhost:~$ ps axuUSER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMANDroot 1 0.0 0.0 1528 528 ? S 10:50 0:00 init [2]root 2 0.0 0.0 0 0 ? SN 10:50 0:00 [ksoftirqd/0]root 3 0.0 0.0 0 0 ? S< 10:50 0:00 [events/0]root 4 0.0 0.0 0 0 ? S< 10:50 0:00 [khelper]root 20 0.0 0.0 0 0 ? S< 10:50 0:00 [kblockd/0]root 50 0.0 0.0 0 0 ? S 10:50 0:00 [pdflush]root 51 0.0 0.0 0 0 ? S 10:50 0:00 [pdflush]root 53 0.0 0.0 0 0 ? S< 10:50 0:00 [aio/0]root 52 0.0 0.0 0 0 ? S 10:50 0:00 [kswapd0]root 189 0.0 0.0 0 0 ? S 10:50 0:00 [kseriod]root 210 0.0 0.0 0 0 ? S< 10:50 0:00 [ata/0]root 304 0.0 0.0 0 0 ? S 10:50 0:00 [kjournald]root 585 0.0 0.0 0 0 ? S 10:50 0:00 [khubd]root 2458 0.0 0.0 1700 696 ? Ss 10:51 0:00 dhclient -e -pf /daemon 2462 0.0 0.0 1640 444 ? Ss 10:51 0:00 /sbin/portmaproot 2627 0.0 0.0 1584 624 ? Ss 10:51 0:00 /sbin/syslogdroot 2630 0.0 0.1 2428 1444 ? Ss 10:51 0:00 /sbin/klogdDebian- 2664 0.0 0.1 4212 1472 ? Ss 10:51 0:00 /usr/sbin/exim4 -tyler 2669 0.0 0.1 2904 1472 ? Ss 10:51 0:00 /usr/sbin/famd -Twnn 2673 0.0 0.3 5276 3944 ? S 10:51 0:00 /usr/bin/Wnn4/jseroot 2680 0.0 0.0 1564 520 ? Ss 10:51 0:00 /usr/sbin/inetdroot 2687 0.0 0.1 3428 1444 ? Ss 10:51 0:00 /usr/sbin/sshdroot 2712 0.0 0.3 5016 3472 ? Ss 10:51 0:00 /usr/bin/X11/xfsroot 2784 0.0 0.1 2760 1460 ? S 10:51 0:00 /bin/bash /etc/rcroot 2785 0.0 0.1 2760 1460 ? S 10:51 0:00 /bin/bash /etc/rcroot 2786 0.0 0.2 9020 2760 ? S 10:51 0:00 /usr/bin/Xprt -acroot 2788 0.0 0.1 2760 1464 ? S 10:51 0:00 /bin/bash /etc/rcdaemon 2795 0.0 0.0 1716 628 ? Ss 10:51 0:00 /usr/sbin/atdroot 2855 0.0 0.0 1788 732 ? Ss 10:51 0:00 /usr/sbin/cronroot 2861 0.0 0.2 8860 2324 ? Ss 10:51 0:00 /usr/bin/gdmroot 2868 0.0 0.2 9204 2752 ? S 10:51 0:00 /usr/bin/gdmroot 2870 0.0 0.0 1528 480 tty1 Ss+ 10:51 0:00 /sbin/getty 38400root 2873 0.0 0.0 1528 480 tty4 Ss+ 10:51 0:00 /sbin/getty 38400root 2875 0.0 0.0 1528 484 tty6 Ss+ 10:51 0:00 /sbin/getty 38400root 2971 5.8 6.5 81604 67912 ? S<L 10:51 0:49 /usr/X11R6/bin/Xroot 3069 0.0 0.0 0 0 ? S 10:51 0:00 [kapmd]root 3102 0.0 0.0 1528 484 tty3 Ss+ 10:51 0:00 /sbin/getty 38400root 3128 0.0 0.0 1528 484 tty5 Ss+ 10:51 0:00 /sbin/getty 38400tyler 3165 0.0 0.8 18660 9324 ? Ss 10:51 0:00 /usr/bin/gnome-setyler 3229 0.0 0.0 3004 880 ? Ss 10:51 0:00 /usr/bin/ssh-agentyler 3232 0.1 0.7 10776 7476 ? S 10:51 0:01 /usr/lib/gconf2/gtyler 3234 0.0 0.0 2284 1020 ? S 10:51 0:00 /usr/bin/gnome-ketyler 3236 0.0 0.2 7112 2864 ? Ss 10:51 0:00 /usr/lib/bonobo-aroot 3237 0.0 0.0 1528 480 tty2 Ss+ 10:51 0:00 /sbin/getty 38400tyler 3249 0.0 0.2 7728 2684 ? Ss 10:51 0:00 gnome-smproxy --styler 3251 0.0 0.8 20372 8592 ? S 10:51 0:00 /usr/lib/control-tyler 3288 0.1 0.7 13704 7400 ? Ss 10:51 0:00 metacity --sm-savtyler 3299 0.0 1.1 20952 12348 ? Ss 10:51 0:00 gnome-panel --sm-tyler 3301 0.0 1.7 36076 17648 ? Ss 10:51 0:00 nautilus --sm-contyler 3303 4.6 3.2 77188 34168 ? Ss 10:51 0:38 /usr/bin/python /tyler 3305 0.1 0.7 46760 7636 ? Ss 10:51 0:00 xmms --sm-client-tyler 3310 0.0 0.3 17368 3612 ? S 10:51 0:00 /usr/lib/gnome-vftyler 3328 0.0 0.0 2220 764 ? S 10:51 0:00 /usr/lib/nautilustyler 3333 0.0 0.9 18220 9404 ? S 10:51 0:00 /usr/lib/gnome-patyler 3335 0.0 0.9 18136 9668 ? S 10:52 0:00 /usr/lib/gnome-patyler 3349 6.8 4.1 112656 42820 ? S 10:52 0:54 /usr/lib/mozilla-tyler 3575 0.0 0.1 3816 1924 ? S 10:56 0:00 /usr/bin/xscreenstyler 3781 17.5 1.2 31500 13248 ? R 11:05 0:00 gnome-terminaltyler 3782 0.0 0.0 2236 672 ? S 11:05 0:00 gnome-pty-helpertyler 3783 0.0 0.1 4824 1672 pts/1 Ss 11:05 0:00 bashtyler 3787 0.0 0.0 2528 848 pts/1 R+ 11:05 0:00 ps axu
Hero of Allacrost - A free, open-source 2D RPG in development.
Latest release June, 2015 - GameDev annoucement
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement