Is it possible to limit the cpu shares for processes started from cron? Background: We have shared hosting on Centos7 and customers can make cronjobs via directadmin controlpanel. Sometimes these cronjobs eat all cpu. That's why I would like to limit the cpu for processes started by cronjobs.
I tried:
# systemctl set-property crond.service CPUShares=500
But jobs started from cron seem to go to the user.slice: /user.slice/user-1003.slice/session-283630.scope
# systemctl show session-283630.scope -p CPUShares
CPUShares=18446744073709551615
So it looks like it does not inherited the cpushares.
Is it possible to limit the cpu shares for cronjobs?
BTW: why does it show CPUShares=18446744073709551615 and not CPUShares=1024? When I check in /sys/fs/cgroup/cpu,cpuacct/user.slice/user-0.slice/cpu.shares it shows 1024:
# cat /sys/fs/cgroup/cpu,cpuacct/user.slice/user-0.slice/cpu.shares
1024
But with systemctl is shows CPUShares=18446744073709551615:
# systemctl show user-0.slice -p CPUShares
CPUShares=18446744073709551615