DEV Community

Discussion on: Bash script to log and restart docker container based on cpu usage

Collapse
 
semotech profile image
SemoTech

My thanks @tomasggarcia , this is exactly what I needed following the discovery that one of my Docker containers (homebridge running on Ubuntu server) was using 300% CPU, and raising the machine temperature to 140deg! Don't really want to monitor the stats live all the time, or worry about it, so needed something to restart the container if that happened again.

Could you be so kind as to advise what each of the files should be called, what permissions they need, and where they need to go on an Ubuntu 20.04 server? Also, are any crons needed, and if so how should they be setup? Much appreciated in advance.