Reputation: 1981
I want to have a cron job that will set the priority of some services, however, the parent runs as root and the rest as another user. However, the parent will respawn processes with it's priority ID so the cron job would have to run way more then it should. Is there a way to do this to set priority's?
Example of what I want to set higher:
1 S root 13826 1 0 81 0 - 3289 rt_sig 00:33 ? 00:00:00 nginx: master process /usr/local/sbin/nginx -c /etc/nginx/nginx.conf
5 S root 15474 1 0 75 0 - 3848 - Apr22 ? 00:01:37 /usr/local/apache/bin/httpd -k start -DSSL
5 S nobody 19511 13826 0 75 0 - 3297 - 13:06 ? 00:00:10 nginx: worker process
5 S nobody 19512 13826 0 78 0 - 3361 - 13:06 ? 00:00:11 nginx: worker process
5 S nobody 19513 13826 0 75 0 - 3681 - 13:06 ? 00:00:09 nginx: worker process
5 S nobody 19514 13826 0 78 0 - 3297 - 13:06 ? 00:00:07 nginx: worker process
5 S root 19521 15474 0 77 0 - 3561 - 13:06 ? 00:00:00 /usr/local/apache/bin/httpd -k start -DSSL
5 S nobody 19522 15474 0 78 0 - 3848 431083 13:06 ? 00:00:00 /usr/local/apache/bin/httpd -k start -DSSL
5 S nobody 19523 15474 0 75 0 - 3952 semtim 13:06 ? 00:00:00 /usr/local/apache/bin/httpd -k start -DSSL
5 S nobody 19524 15474 0 75 0 - 3951 semtim 13:06 ? 00:00:00 /usr/local/apache/bin/httpd -k start -DSSL
5 S nobody 19525 15474 0 75 0 - 3949 semtim 13:06 ? 00:00:00 /usr/local/apache/bin/httpd -k start -DSSL
5 S nobody 19526 15474 0 78 0 - 3947 - 13:06 ? 00:00:00 /usr/local/apache/bin/httpd -k start -DSSL
5 S nobody 19527 15474 0 78 0 - 3949 semtim 13:06 ? 00:00:00 /usr/local/apache/bin/httpd -k start -DSSL
I know there is http://www.rfxn.com/projects/system-priority/ but as far as I know that only does it by UID.
Upvotes: 2
Views: 2169
Reputation: 14149
The question isn't very clear, you can easily find the parent PID though by looking at /proc/18357/stat
replacing 18357 with the PID of the current process
the parent PID is the fourth argument in there
Upvotes: 4