Both methods should work, but IMO it's cleaner to put nice
into the script just as you did in your example. After a check with man nice
I found that example in question had wrong syntax. The right syntax would be:
nice -n 10 command
Nicenesses range from -20 (most favorable scheduling) to 19 (least favorable).
And, as terdon said, 10 is the default value so "-n 10" can be omitted.
Note: Although it will lower the process priority, nice won't make it cause less CPU load. So, if only reason to worry about is not to "choke" the apache
, then this method is OK. But if your hosts give you some CPU time quota, this won't help a lot.