How to permanently set higher process priority in GUI

Karl Auer kauer at biplane.com.au
Sat Jul 18 11:27:21 UTC 2015


On Sat, 2015-07-18 at 02:13 -0700, Tony Baechler - BATS wrote:
> > particular nice value, the simplest way would be to rename ffmpeg to
> > ffmpeg.bin and create a script called ffmpeg that runs ffmpeg.bin

> Yes, I am aware of this.  If you read my question, I stated that this must 
> be done from the GUI.  I do not have access to the desktop in question and I 
> would have no way of installing such a script.

I did read your question. Based on your information, I provided a
solution where the GUI does not even need to be reconfigured - it just
silently uses your ffmpeg instead of the real one, and doesn't need path
changes to do so. You implied that you could "guide the user" - well,
guide him through running some scripts. Only needs to be done once.

If what you really meant was "is there a GUI that lets the user set the
nice value for ffmpeg" you should have said that. I know of no such
program, but maybe someone else does.

>   Also, that wouldn't work 
> anyway because upgrades to ffmpeg would overwrite my script, so it wouldn't 
> be permanent.

There is no solution that avoids that if the PATH cannot be changed AND
the GUI cannot be configured to use a different executable AND the GUI
uses a fully qualifies path. If any of those things are false, then
ffmpeg can be wrapped.

If you are able to change the PATH used but not the GUI configuration,
then you can call your script ffmpeg, put it somewhere not in the
standard install, make sure that location is earlier in the path than
the location of the real ffmpeg, and have your script explicitly call
the real ffmpeg.

These are generic solutions. The first one (rename ffmpeg and set up a
script called ffmpeg in the same location) works with any GUI, even one
that explicitly specifies the full path to the ffmpeg executable. The
second works only with those GUIs that execute ffmpeg without an
explicit path.

Obviously if you can reconfigure the GUI to use a particular executable,
then you configure it to call your script instead of the real ffmpeg.
Most frontends have that capability.

> Finally, the user has no idea how to write such a script and 
> there would be little point in trying to give him instructions.  As I 
> understand it, you can't really set a process to the highest priority as a 
> normal user, so he would have to switch to root every time.  That is way 
> more complex than he wants to do without a GUI solution.

You are assuming barriers where there are none. He doesn't write the
script - you do. It's two lines. You can make your ffmpeg-runner script
setuid, so it is runnable by an ordinary user but has root's access.
That's a bit unsafe; make sure the script is writable only by root[1].
Then give him the ffmpeg-runner and a script to install it - i.e., move
it to the right location and make it setuid. Tell him to put both
scripts in his home directory and to run the install script with sudo.
Job done. If he cannot do that, and cannot even be guided through doing
it, then he has no business having administrative access to his machine
at all.

Perhaps you could get remote access to his machine and do it for him?
VNC or ssh if he has IPv6 or is not NATted. If he only has IPv4 and is
behind NAT you could use something like TeamViewer.

Here's another idea. If he can use a GUI file manager, let him upload
stuff to a particular directory on the server. On the server, have a
cron job that checks that directory for new uploads and if it finds any,
converts and transfers them to their final destination (it should check
for file size changes so it doesn;t try to convert a file while it is
still uploadng). Then you can be as sophisticated as you like, and he
can remain as ignorant of the process as he wishes to be.

Regards, K.

[1] Even better, write a setuid C wrapper that runs "nice whatever"
rather than a script.
 
-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Karl Auer (kauer at biplane.com.au)
http://www.biplane.com.au/kauer
http://twitter.com/kauer389

GPG fingerprint: 3C41 82BE A9E7 99A1 B931 5AE7 7638 0147 2C3C 2AC4
Old fingerprint: EC67 61E2 C2F6 EB55 884B E129 072B 0AF0 72AA 9882






More information about the ubuntu-users mailing list