renaming the excutable for /bin/ps command

General support for problems installing or using Deluge
Post Reply
spmskr
Member
Member
Posts: 10
Joined: Sat Jul 25, 2020 3:10 am

renaming the excutable for /bin/ps command

Post by spmskr »

Hello everyone,

to be able to run multiple versions of executables and manipulate them separately with scripts, I use sym links.
So I have a symlink:
del01_demon -> /usr/bin/deluged

in the output of /bin/ps this executable now shows up as del01_demon

This isn't working with deluge-gtk

The python code looks very similar (to someone who used to
program PERL 20 years ago, so I can't really tell) - anyone
know what's going on here?

& how I could rename deluge-gtk such that /bin/ps shows it differently?
mhertz
Moderator
Moderator
Posts: 2195
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: renaming the excutable for /bin/ps command

Post by mhertz »

Sorry but what exactly isn't working? I just tested 'ln -s /usr/bin/deluge-gtk ~/.local/bin/foo', and 'foo' started GTKUI fine for me. I also tested non-symlinked deluge-gtk connecting fine to symlinked deluged, if that was the scenario, sorry wasen't sure honestly and i'm probably misunderstanding something :)
spmskr
Member
Member
Posts: 10
Joined: Sat Jul 25, 2020 3:10 am

Re: renaming the excutable for /bin/ps command

Post by spmskr »

(if there's too much identifying info here, let me know)
if I start the program using the name foo,
/bin/ps should report it as foo.

I just re-did the links again & tried it: (the square brackets in the grep is to hide the grep from the ps output)

Code: Select all

ps ax | grep [w]g_del
1233705 ?        Sl     0:01 /usr/bin/python3 /home/frank/bin/wg_del_demon
With the links I just set up now, ps reports deluged as /home/frank/bin/wg_del_demon,
I had deluge-gtk linked to wg_gtk and ps always reports it as deluge-gtk

Code: Select all

ps ax | grep [w]g_gtk
       (no result)

ps ax | grep [d]eluge-gt
1233795 pts/111  Sl     0:04 deluge-gtk

mhertz
Moderator
Moderator
Posts: 2195
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: renaming the excutable for /bin/ps command

Post by mhertz »

Sorry I completelly missed the ball on this one lol, thanks for spelling it out for me :)

Yeah, that is because of deluge using setproctitle for changing process-name of UIs. If reading up on changing ps process-name in general, then not super easy with regular means, so if possible for you then easiest is to change deluge code, commenting out line 68(master/v2.0.3 and develop) in 'deluge/ui/ui.py', e.g. on my used distro: '/usr/lib/python3.9/site-packages/deluge/ui/ui.py'. Actually, I can see that setproctitle is optional in the way used in code, both in deluge/ui/ui.py and deluge/ui/gtk3/gtkui.py, so if not using it for other means then might get away by force uninstalling python(3)-setproctitle from your system, but it gets installed automatically when building from source and likewise a required dep in my used distro's deluge package, and I see it's listed in requirements.txt of source and I'm unaware if that is verified in some way during runtime(e.g pkg_resources' raising required distributionNotFound error), but not atleast by deluge in the places where utilized. I should probably make a bug-ticket about this i.e optional deps "hardcoded" in requirements.txt. (Edit: After reading little up on python packaging intrinsics, then not bug I believe listing opt-deps in requirements.txt, and is just for quickly setting up dev-environment with pip and not intended ditributable, and comment could also just be added about it there, but anyway, listing opt-deps in setup.py, under 'install_requires' presumably would be classified as bug I'd speculate, so should be that I report instead, if remember later, slash not being to lazy) (Edit2: Done - https://dev.deluge-torrent.org/ticket/3470)
Post Reply