Linux "nice" command

Red Squirrel

No Lifer
May 24, 2003
70,186
13,578
126
www.anyf.ca
Is there a way to make it so if I call up a bash script with the nice command that all commands called within that bash script automaticly are run at that same priority?

I want to add nice -10 in my cron jobs to make them run low priority but they call up gzip which then runs at normal priority, defeating the purpose.
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
-10 is high priority, you want higher numbers for lower priority. Nice the script itself, all child processes inherit the priority of their parent. Although IIRC cron automatically starts all of it's jobs at a lower priority of either 5 or 10.
 

Red Squirrel

No Lifer
May 24, 2003
70,186
13,578
126
www.anyf.ca
Oh my bad, but when I tested with -10 all the scripts run off the original script were running at 0, so there must be a parameter I have to pass to nice to tell it to use same priority as all other apps started by the script ran at 0. But if cron does it automaticly then I may be ok to not touch it.
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
If the bash process running the original script is -10 then all commands started by it will be -10 as well. It's always been that way AFAIK. And again, if you want them to run at _low_ priority then you want higher numbers, negative numbers are higher priorities.