我希望有一个cron作业来设置某些服务的优先级,但是,父作为root运行,其余作为另一个用户运行。但是,父级将使用它的优先级ID重新生成进程,因此cron作业必须运行得更多。有没有办法设置优先级?
我想要设置更高的示例:
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
我知道有http://www.rfxn.com/projects/system-priority/但据我所知,只有UID才会这样做。
答案 0 :(得分:3)
问题不是很清楚,你可以通过查看/proc/18357/stat
用当前过程的PID代替18357轻松找到父PID
父PID是
中的第四个参数