To throttle CPU usage for the database backups from this post - https://hnsws.blogspot.com/2023/01/backing-up-mysql-databases-to-google.html
This was not the correct way to use cpulimit to throttle the gzip process -
gzip $FILE & sleep 2 & cpulimit --limit 50 -P gzip -z
ChatGPT says,
- gzip $FILE & starts immediately in the background.
- cpulimit is started after gzip has already launched, so depending on timing, cpulimit may or may not catch and limit the gzip process in time.
- The sleep 2 & doesn't help — it runs in parallel but doesn’t delay cpulimit.
Corrected version which can be run in cron is
$CPULIMIT --limit 50 -- $GZIP $FILE
where we have to supply the full paths to cpulimit, gzip and the file in those variables.
No comments:
Post a Comment