2

I got a script that backs up minecraft worlds, when ran by command (nice -19 ./backup.sh) it doesn't lag what so ever, server load stays low. When I try to do nice -19 ./backup.sh in a cronjob, it doesn't "nice" it and it uses a high amount of server resources. Isn't there a renice command? Can't I some how input that in the code to make it renice itself everytime it runs? But how would I get the PID of the script?

Thank you!

1 Answers1

0

Inside your script you should both renice it and ionice it, e.g. in bash:

#!/bin/bash

renice 19 -p $$
ionice -c 3 -p $$

...

The $$ in bash stands for the process ID of the current bash.

Urist McDev
  • 121
  • 2