Prioritizing Linux services
Administrating a Linux system is always interesting, especially when something starts hogging the resources and people start complaining. Everyone wants their e-mail on time and spam free, but nobody wants to wait on a slow web server. What to do? Put a priority on your services!
My initial thought was “wow, someone must have thought about this before me”, and I looked briefly through the service scripts in /etc/rc.d/init.d. I was specifically interested in tweaking the nice level for the Amavis daemon, but found nothing in the amavisd file – just a simple call to the daemon function in /etc/rc.d/init.d/functions.
With my initial thought still fresh in my mind, I dug down in the functions script, and saw that it actually honours a couple of environment variables set by the configuration scripts in /etc/sysconfig – one of them being NICELEVEL.
In short: if you want a service – like the Amavis daemon – to run with priority 15, add this to /etc/sysconfig/amavisd:
NICELEVEL=18