简体   繁体   中英

Run binary with highest priority

I am running one binary with highest priority like

nice -n -20 binary

Now I want to run same binary such that it runs with high priority without nice -n 20 binary like

 ./binary // runs with high priority same as nice -n -20 binary with any setting

Are there any configurations which says kernel to start process with higher priority when I start binary with ./binary,I don't wont to start binary with nice -n -20 binary every time

So how to do it give your suggestion

Create a script that contains your nice command, and run that instead.

eg

echo  nice -n -20 binary > binary2
chmod +x binary2

And then to run it, just do this:

./binary2

you can create alias for it

alias binary='nice -n -20 binary'

after that if you execute binary then it will start with higher priority

I believe you want something like this,

sudo nice -n -20 ./binary

From info coreutils 'nice invocation'

Only a privileged user may run a process with lower niceness:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM