Debian – How to prevent cron jobs from being run during certain times in Debian? (a ‘gaming’ / ‘performance mode’)

cpucrondebianlaptopperformance

It looks like I have logcheck set up as a cron job and whenever it's run process grep by logcheck takes up around ¼ of my CPU.

Now I have certain times during which I need my full CPU capacity and have my system take up fewest resources as possible except for specific/processes (which I maybe could specify somehow).

Is it possible to set my Debian 9.1 with KDE machine into some sort of performance mode (or 'Gaming mode') that prevents processes not explicitly started by the user from taking up much system resources, lowers the load of background-processes and most importantly: delays cron jobs until that mode is stopped again?

Best Answer

If “certain times” aren’t fixed, i.e. you want to specify manually when your system enters and leaves “performance mode”, you can simply stop and start cron:

sudo systemctl stop cron

will prevent any cron jobs from running, and

sudo systemctl start cron

will re-enable them.

You could also check out anacron instead of cron, it might be easier to tweak globally in a way which would fit your uses.

Related Question