Nice command in .sh script for Cron Jobs Nice command in .sh script for Cron Jobs apache apache

Nice command in .sh script for Cron Jobs


skip the shell script and use

* * * * * /usr/bin/nice -n 10 /path/php -q /path/script.php

nice and\or php path may or may not be required


I'm sorry I asked this question in two places as I thought I wasn't getting a response.I asked at Superuser and I received an answer that suits my needs.

@Dagon - The answer from Dagon would seem to work as well and I will provide an update when I have resolved this issue with either solutions.

The same Question asked at Superuser - https://superuser.com/questions/537509 ...

UPDATE: I used the batch file as shown there. I used the nice command before php inside the batch file. The only difference being:

nice -n 10 php -q ./run_interactive_job.php batch_control_files/updateDB

I added more commands to run additional php scripts with the same nice property to them. They all worked great.

THANKS EVERYONE FOR THE INPUT


Either way is fine. If you put the nice in the Cron job itself, it will affect the priority of the entire job; but since the script only contains one command whose priority it really makes sense to set, doing it inside the script works just as well in practice.