brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: nice and ionice keep a heavy linux job out of everyone's way

Linux
~/tips/tip-linux-nice-ionice-heavy-job

nice -n 19 ionice -c3 tar -czf /backup/www.tar.gz /var/www

Runs a heavy command with the lowest CPU and disk priority.

I run backups and big archives at the lowest priority so the rest of the server stays responsive.

nice -n 19 ionice -c3 tar -czf /backup/www.tar.gz /var/www

nice -n 19 gives the job the lowest CPU priority. ionice -c3 puts its disk access in the idle class, so it only gets I/O when nothing else wants it. The I/O priority only has an effect with schedulers that honor it, so on some systems the effect can be small. A job that never gets I/O time can also run very slowly, so use -c2 -n7 if it must finish.

Further reading: ionice manual page

More Linux tips a2query -m rewrite renice -n 10 -p 4242 cat config.yml | xsel -ib xvfb-run -a your-program --some-flag dpkg --get-selections > packages.txt All Linux tips (261) All topics

Link