chrt -r 20

Ask questions about dedicated servers here and we and other users will do our best to answer them. Please also refer to the self-help section for tutorials and answers to the most commonly asked questions.
Post Reply
mgl
New to forums
New to forums
Posts: 2
https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
Joined: Mon Jan 04, 2010 8:14 pm

chrt -r 20

Post by mgl »

On my VDS, when I run "chrt -r 20" with my start command I get the following output:

sched_setscheduler: Operation not permitted
failed to set pid 0's policy

I was told that this sounds as though I may be running the command as a non-root user. This is true and running the command as root does allow the server to boot however, I'd prefer not to run the server as a root user because it presents a potential security issue. Any help on how to to get this to work as a non-root user would be appreciated.
User avatar
Edge100x
Founder
Founder
Posts: 13126
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: chrt -r 20

Post by Edge100x »

One way to approach this would be to simply use chrt to execute sudo -- something like this:

Code: Select all

chrt -f 50 sudo -u hlds ./srcds_run -game cstrike
Another would be to set up a cronjob as root that chrt's all processes with a certain name or user to the right value at some regular interval.
mgl
New to forums
New to forums
Posts: 2
Joined: Mon Jan 04, 2010 8:14 pm

Re: chrt -r 20

Post by mgl »

Thanks for the suggestions.

1. I'm not too clear on the difference between the fifo and rr schedulers though. Why did you put "chrt -f 50" in your example as opposed to "chrt -r 20" like you have in this post?

2. I usually run my servers using screen like so:
screen -A -m -d -S sessionname ./hlds_run -game cstrike

How would I go about using your first suggestion while also running the server via a screen session?
User avatar
Edge100x
Founder
Founder
Posts: 13126
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: chrt -r 20

Post by Edge100x »

mgl wrote:1. I'm not too clear on the difference between the fifo and rr schedulers though. Why did you put "chrt -f 50" in your example as opposed to "chrt -r 20" like you have in this post?
You can use either one for your game server -- they have the same performance for this application in my testing (the key is the fact that it puts the server into a realtime class, which changes the way timer slack is handled). If chrt -r has been working well for you, I'd say stick with it.
2. I usually run my servers using screen like so:
screen -A -m -d -S sessionname ./hlds_run -game cstrike

How would I go about using your first suggestion while also running the server via a screen session?
I'd recommend putting screen on the outside so that part runs as root and doesn't get realtime priority:

Code: Select all

screen -AmdS sessionname chrt -f 50 sudo -u hlds ./srcds_run -game cstrike
Post Reply