limit systemd service

  • under /etc/systemd/system create a directory <servicename>.service.d
  • create a conf file under that directory 10-cpulimits.conf
  • inside the conf, add content
  1. [Service]
  2. LimitCPU=60

then systemctl daemon-reload
ssytemctl restart