Regularly retrieve the process memory and write the log Shell code www.2cto.com $ catmem. sh #! /Bin/bashLOGFILE & quot;/xxx/mem. log & quot; date + % Y-% m-% d & quot; % H: % M: % S & gt; $ LOGFILEpsaux | grep & amp; #39; bin/eas. regularly retrieve the process memory and write the log Shell code www.2cto.com $ cat mem. sh #! /Bin/bash LOGFILE = "/xxx/mem. log "date + % Y-% m-% d" "% H: % M: % S >>$ LOGFILE ps aux | grep 'Bin/eas. PY' | awk '{if ($13 ~ /^ \ W + $/) {print $13, $4} '>>$ LOGFILE $ crontab-l */1 *****/xxx/mem. sh $ crontab-e # Edit $ crontab-r # DELETE the crontab domain to run the job at a specific time, you need to understand the meaning and format of each domain in each entry of the c r o n t a B file. The following are the fields: minute 1-minute in column 1st ~ 5 9 2nd columns hour 1 ~ 2 3 (0 indicates midnight) 3rd Columns 1 ~ 3 1 4th columns month 1 ~ 1 2 5th columns day of week 0 ~ 6 (0 indicates Sunday) 6th column command Shell code to run 1. $ crontab-l 2.0 * ps aux | grep 'Bin/eas. PY' | awk '{if ($13 ~ /^ \ W + $/) {print $13, $4} '> "/xxx/mem. log", which runs directly behind crontab
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service