View previous topic :: View next topic |
Author |
Message |
yther Apprentice
Joined: 25 Oct 2002 Posts: 151 Location: Charlotte, NC (USA)
|
Posted: Thu Apr 30, 2009 5:12 am Post subject: How to allow myself negative nice? |
|
|
OK, I am trying to allow myself (i.e., me as a normal user and absolutely not as root) to start a certain task at a negative nice level. I have added my user to /etc/security/limits.conf:
Code: | rassilon hard nice -15 |
However, when I try to start something with a lower nice value than 0, I am not allowed. I tried the same with "soft" instead, and got the same result.
Code: | rassilon@miharu ~ $ nice -n -1 xclock
nice: cannot set niceness: Permission denied |
I want to be able to do this so I can put the "nice" bit into a menu and not have to run "renice" as root after starting the processes.
Obviously I am missing something, but what? I don't want to resort to changing the system's setup, or adding my user to the "root" group, unless there's no other way. I also do not want to use "sudo" to run the process, because then the files it touches will wind up owned by root, which is a hassle.
Thanks for any clues! Even "RTFM" would help if you mention which M to FR. |
|
Back to top |
|
|
ToeiRei Veteran
Joined: 03 Jan 2005 Posts: 1191 Location: Austria
|
Posted: Thu Apr 30, 2009 6:45 am Post subject: |
|
|
What about a sudo wrapper?
Rei _________________ Please stand by - The mailer daemon is busy burning your messages in hell... |
|
Back to top |
|
|
yther Apprentice
Joined: 25 Oct 2002 Posts: 151 Location: Charlotte, NC (USA)
|
Posted: Thu Apr 30, 2009 1:44 pm Post subject: |
|
|
ToeiRei wrote: | What about a sudo wrapper? |
I'm not sure I understand. Sudo, as I stated in my first post, causes the process to start as root. Using sudo was the first thing I considered, but then rejected; I want to avoid that because it will change the ownership of my files.
So, I could use a wrapper such as kdesu, but then I get the process running as root, and files it creates will be owned by root. That's not good. Do I misunderstand your suggestion? |
|
Back to top |
|
|
albright Advocate
Joined: 16 Nov 2003 Posts: 2588 Location: Near Toronto
|
Posted: Thu Apr 30, 2009 1:58 pm Post subject: |
|
|
it's not elegant but can you start the process and then
sudo renice it ? _________________ .... there is nothing - absolutely nothing - half so much worth
doing as simply messing about with Linux ...
(apologies to Kenneth Graeme) |
|
Back to top |
|
|
desultory Bodhisattva
Joined: 04 Nov 2005 Posts: 9410
|
Posted: Fri May 01, 2009 2:50 am Post subject: |
|
|
yther wrote: | I'm not sure I understand. Sudo, as I stated in my first post, causes the process to start as root. | It goes both ways, though in the majority of cases it does not need to as there is a lazier way. |
|
Back to top |
|
|
yther Apprentice
Joined: 25 Oct 2002 Posts: 151 Location: Charlotte, NC (USA)
|
Posted: Fri May 01, 2009 4:02 pm Post subject: |
|
|
desultory wrote: | yther wrote: | I'm not sure I understand. Sudo, as I stated in my first post, causes the process to start as root. |
It goes both ways, though in the majority of cases it does not need to as there is a lazier way. |
What do you mean by "it goes both ways"? I seem to be unusually stupid this week...
Anyway, I'm still looking for a better solution, but I think I can do something like this little (untested) script:
Code: | #!/bin/bash
VMWARE_VARIABLES_BLAHBLAH="stuff" vmplayer $HOME/VMs/vm.vmx
kdesu renice -15 `pidof vmplayer` |
That won't work predictably if there are multiple instances of vmplayer, but I don't run multiple VMs yet, so it should do for the moment.
I'm still amazed that there seems to be no way to simply allow myself (as a user) the ability to give my own processes a high priority. I need to spend some time doing an intense search, I guess, because the setting in "limits.conf" seems to have no effect, and I don't know why. |
|
Back to top |
|
|
neysx Retired Dev
Joined: 27 Jan 2003 Posts: 795
|
Posted: Fri May 01, 2009 4:06 pm Post subject: |
|
|
sudo nice -n -10 su username -c command |
|
Back to top |
|
|
yther Apprentice
Joined: 25 Oct 2002 Posts: 151 Location: Charlotte, NC (USA)
|
Posted: Sat May 02, 2009 12:45 am Post subject: |
|
|
neysx wrote: | sudo nice -n -10 su username -c command |
Ah, I finally see the light! Thank you, and sorry for not seeing that possibility myself. |
|
Back to top |
|
|
sswam n00b
Joined: 17 Jun 2011 Posts: 1 Location: Melbourne, Australia
|
Posted: Fri Jun 17, 2011 4:19 pm Post subject: Re: How to allow myself negative nice? |
|
|
To answer the original question, now 2 years old!
Code: | rassilon - nice -15 |
I.e, write a dash not hard nor soft.
This works ok for me, and it can indeed be very useful. |
|
Back to top |
|
|
numlock n00b
Joined: 17 Sep 2004 Posts: 58
|
Posted: Tue Jun 07, 2016 8:05 pm Post subject: Re: How to allow myself negative nice? |
|
|
sswam wrote: | To answer the original question, now 2 years old!
Code: | rassilon - nice -15 |
I.e, write a dash not hard nor soft.
This works ok for me, and it can indeed be very useful. |
Awesome, thank you!
Just a note: the "max" value for nice is -20. |
|
Back to top |
|
|
|