knstyl Wrote:How would I run taskset on screen?
This is what I have at the moment, it runs but I'm not quite sure if it's working correctly. Load seems to be on cpu 0, but just wanted to make sure so I can sleep at night. Thanks.
Quote:screen -m -d -s -- taskset -c 3 ./srcds_run -etc ..
That is correct.
You can use "taskset -p <pid>" to find out how it's set up. So, for example to look up the affinity on my css server I do this.
Code:
ps -xaufw | grep srcds
That will list all processes and filter processes with "srcds" in it. In the list I can see:
Code:
css 26067 1.6 0.1 149272 3224 pts/11 RNl+ Jun17 365:40 \_ ./srcds_amd -game cstrike
The 26067 is the process id (pid), which I can then use with taskset -p. So the result is:
Code:
$ taskset -p 26067
pid 26067's current affinity mask: 3
Or even better, use the "-c" switch so taskset lists the actual CPU cores:
Code:
$ taskset -c -p 26067
pid 26067's current affinity list: 0,1
There. The server I'm running is set to run on both cores. Cool.
It would be also good if you tried out more the "screen" command. Most users just run "screen -bunch -of -parameters -they -dont -know -about", and that's why this kind of questions come up. Go ahead and write plain "screen". That will launch new shell window inside the current shell. Then you can do for example "cd /home/knstyl". "cd tf2server". "./srcds_run -game tf .....". Then the game is running. Then detach the server by pressing "CTRL-a d" (ie. first press "ctrl-a", then press just "d"). The screen session will get "detached", and the tf2 server will run on background. You will see "[detached]" after you detach from screen.
You can also start many screen sessions. You could have multiple servers for example. You can give names to the screen sessions to make it easier for you to attach to them later.
Even more advanced stuff is to learn all the hot-keys of screen and just use one screen for all your needs. For example you could start one screen named "servers", and then create multiple "windows" inside that one screen session.
If you would know all this you wouldn't ask questions like "How would I run taskset on screen?". Stupid answer to the stupid question would be "you run it the same way you run it in normal shell". However, everybody starts as a newbie.