How to stop the Prstat using shell script ?
because after i run the below script the thing seems to be always in loop and cannot get out till i ctrl + c, is there anything that i can add in the script to make it terminate ?
is there anyway i can put them all into separate txt files but can i put all the output into one file ? Please advise and thank you ghostdog for your help
i've tried the above and it doesn't work can someone please guide me thanks
and btw is there any good website that i can refer to for such codings of shell?
in a prstat there are so many values if i want to specifically pick one value and compare it, is it possible ?
In the above case i did a
prstat -Tc -u hellousr
then i changed to
prstat -Tc -u hellousr | grep 1
because i wanted to grep the taskid = 1 line and i am only interested in the CPU Usage value, 0.5%. However, when i do a grep 1 all the things are shown.
i need to do a if statement using script for it like
if CPU Usage for TASKID=1 > 0.5% , then it is known to be unhealthy else it is healthy.
it works already
but can you please explain abit on whats the
awk 'NR==4{print $7}'
i only knows that awk is a process and it extract out the 7th char base on print $7 how about the rest ?