I have this php script that I need to run on shared webhosting. I have created a cron job that executes an sh script. The command for the cron was:
/bin/sh /home/user/script.sh
So I'm assuming it is Bourne Shell (or something compatible). The script itself was:
#!/bin/sh
cd /home/user/public_html/folder/
#updating DB
php -q ./run_interactive_job.php batch_control_files/updateDB
echo Updated DB results
My question is:
Can I add Nice priorities to the php command ? Or do I need to add it to the script at the cron command. Which one is more likely to work ?
nice 10 php -q ./run_interactive_job.php batch_control_files/updateDB
Would that be successful at running at a lower priority.
PS: Basically, this script has overloaded the server before when I ran it through the browser and it affected apache on that server resulting in my hosts blocking the file. I have repeatedly asked them unblock to test it with different parameters. And Now I'm trying to run it through cron at a lower priority in the hopes that it won't affect apache. But I don't want it to create issues again, hence I'm trying to use NICE
If anyone has any other suggestion that would offer a similar solution of running the php script without affecting apache or the webserver, that'sgreat too.