Created
February 15, 2022 07:20
-
-
Save omidp/fef4f0f7a0171c8ed604fd3115cc6805 to your computer and use it in GitHub Desktop.
monitor cpu and mem for a pid
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vi pdmonitor.sh | |
########### | |
#!/bin/sh | |
while true | |
do | |
date | |
ps -p [PID] -o %cpu,%mem | |
sleep 5 | |
done | |
############ | |
chmod +x pdmonitor.sh | |
############ | |
./pdmonitor.sh | |
OR | |
./pdmonitor.sh > result.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
other commands