Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How to allow myself negative nice?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
yther
Apprentice
Apprentice


Joined: 25 Oct 2002
Posts: 151
Location: Charlotte, NC (USA)

PostPosted: Thu Apr 30, 2009 5:12 am    Post subject: How to allow myself negative nice? Reply with quote

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
View user's profile Send private message
ToeiRei
Veteran
Veteran


Joined: 03 Jan 2005
Posts: 1191
Location: Austria

PostPosted: Thu Apr 30, 2009 6:45 am    Post subject: Reply with quote

What about a sudo wrapper?

Rei
_________________
Please stand by - The mailer daemon is busy burning your messages in hell...
Back to top
View user's profile Send private message
yther
Apprentice
Apprentice


Joined: 25 Oct 2002
Posts: 151
Location: Charlotte, NC (USA)

PostPosted: Thu Apr 30, 2009 1:44 pm    Post subject: Reply with quote

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
View user's profile Send private message
albright
Advocate
Advocate


Joined: 16 Nov 2003
Posts: 2588
Location: Near Toronto

PostPosted: Thu Apr 30, 2009 1:58 pm    Post subject: Reply with quote

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
View user's profile Send private message
desultory
Bodhisattva
Bodhisattva


Joined: 04 Nov 2005
Posts: 9410

PostPosted: Fri May 01, 2009 2:50 am    Post subject: Reply with quote

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
View user's profile Send private message
yther
Apprentice
Apprentice


Joined: 25 Oct 2002
Posts: 151
Location: Charlotte, NC (USA)

PostPosted: Fri May 01, 2009 4:02 pm    Post subject: Reply with quote

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
View user's profile Send private message
neysx
Retired Dev
Retired Dev


Joined: 27 Jan 2003
Posts: 795

PostPosted: Fri May 01, 2009 4:06 pm    Post subject: Reply with quote

sudo nice -n -10 su username -c command
Back to top
View user's profile Send private message
yther
Apprentice
Apprentice


Joined: 25 Oct 2002
Posts: 151
Location: Charlotte, NC (USA)

PostPosted: Sat May 02, 2009 12:45 am    Post subject: Reply with quote

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
View user's profile Send private message
sswam
n00b
n00b


Joined: 17 Jun 2011
Posts: 1
Location: Melbourne, Australia

PostPosted: Fri Jun 17, 2011 4:19 pm    Post subject: Re: How to allow myself negative nice? Reply with quote

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
View user's profile Send private message
numlock
n00b
n00b


Joined: 17 Sep 2004
Posts: 58

PostPosted: Tue Jun 07, 2016 8:05 pm    Post subject: Re: How to allow myself negative nice? Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum