Results 1 to 5 of 5

Thread: permanently setting niceness of a process?

  1. #1
    Join Date
    Nov 2010
    Beans
    69

    permanently setting niceness of a process?

    I have a process (java) that I want to run at a lower niceness, currently I run 'sudo renice' on the process, but I want a way to automate it.
    I tried making a script which would run 'sudo nice', but then realized that whatever process I run with this command would have that process running as root, which I dont want Java to have root on my system.

    So is there any setting I can change or add that would always run a process at an adjusting nice level?
    Thnx
    Last edited by Kr0nZ; March 20th, 2013 at 07:18 AM.

  2. #2
    Join Date
    Apr 2012
    Location
    Quebec, Canada
    Beans
    261
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: permanently setting niceness of a process?

    I would like to know that trick, as well.

    Thanks!

  3. #3
    Join Date
    Feb 2007
    Location
    West Hills CA
    Beans
    10,044
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: permanently setting niceness of a process?

    I'm thinking out loud here. If you started a shell with sudo nice -1 bash and then run your JAVA process within that shell, would it run at the same nice level as the shell? If that is the case, then you could write a script with the required nice level.
    -------------------------------------
    Oooh Shiny: PopularPages

    Unumquodque potest reparantur. Patientia sit virtus.

  4. #4
    Join Date
    Feb 2011
    Location
    Coquitlam, B.C. Canada
    Beans
    3,515
    Distro
    Ubuntu Development Release

    Re: permanently setting niceness of a process?

    Please be aware that the actual behaviour of "nice" has changed in recent years depending on the setting of "/proc/sys/kernel/sched_autogroup_enabled".

    For a bit more info see here, which also contains links to other references.
    Any follow-up information on your issue would be appreciated. Please have the courtesy to report back.

  5. #5
    Join Date
    Nov 2010
    Beans
    69

    Re: permanently setting niceness of a process?

    Quote Originally Posted by tgalati4 View Post
    I'm thinking out loud here. If you started a shell with sudo nice -1 bash and then run your JAVA process within that shell, would it run at the same nice level as the shell? If that is the case, then you could write a script with the required nice level.
    Thanks, just what I needed.
    I got the following to work as I wanted
    Code:
    cmd=`echo "/usr/bin/java $tmp" | sudo nice -n -10 bash -c 'su -lm demon'`


    Quote Originally Posted by Doug S View Post
    Please be aware that the actual behaviour of "nice" has changed in recent years depending on the setting of "/proc/sys/kernel/sched_autogroup_enabled".
    For a bit more info see here, which also contains links to other references.
    Thanks, I think I might have to use 'schedtool' instead?

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •