Re: [PLUG] trying to detach running processes - but how?

2022-11-15 Thread Ben Koenig


--- Original Message ---
On Tuesday, November 15th, 2022 at 1:51 PM, American Citizen 
 wrote:


> Using the setsid() CLI command is exactly the right choice here. I have
> restarted the Plasma desktop after logging out and back in and the
> programs were still running attached to pid 1 (as desired)
> 
> What needs to happen now is to fix that annoying memory leak in
> plasmashell task
> 
> Thanks for the post, Kevin
> 
> 
> On 11/13/22 20:55, Kevin Williams wrote:
> 
> > setsid(1) looks like a good tool for detaching magma from bash. Then you 
> > could safely close bash and the konsole and restart plasma and the X server 
> > demons (systemd services) every now and then so that you can free up that 
> > 50% plus of your 32 gigs of ram.

Nice, that's a cool trick. Not sure if this helps or not. But I've been logged 
into KDE Plasma for 7 days now, and plasmashell memory usage is at 213.4 MB. I 
wonder what's causing yours to balloon out of control.


Re: [PLUG] trying to detach running processes - but how?

2022-11-15 Thread American Citizen
Using the setsid() CLI command is exactly the right choice here. I have 
restarted the Plasma desktop after logging out and back in and the 
programs were still running attached to pid 1 (as desired)


What needs to happen now is to fix that annoying memory leak in 
plasmashell task


Thanks for the post, Kevin


On 11/13/22 20:55, Kevin Williams wrote:

setsid(1) looks like a good tool for detaching magma from bash. Then you could 
safely close bash and the konsole and restart plasma and the X server demons 
(systemd services) every now and then so that you can free up that 50% plus of 
your 32 gigs of ram.


Re: [PLUG] trying to detach running processes - but how?

2022-11-14 Thread Robert Citek
Or automatically launch screen from within your .profile.

https://stackoverflow.com/a/20515245

I also alias exit so that I remember to detach instead of exit:

[ ${STY} ] && alias exit="echo You are in a screen: ${STY}."

And I can use \exit if I really want to exit.

Regards,
- Robert

On Mon, Nov 14, 2022 at 7:53 AM Randy Bush  wrote:

> fwiw, i am a `screen` addict.  i do a lot of builds on distant systems
> over ssh, and try to always remember to start screen.
>
> randy
>


Re: [PLUG] trying to detach running processes - but how?

2022-11-14 Thread Randy Bush
fwiw, i am a `screen` addict.  i do a lot of builds on distant systems
over ssh, and try to always remember to start screen.

randy


Re: [PLUG] trying to detach running processes - but how?

2022-11-13 Thread Kevin Williams
Is magma.exe the math application listed here? 
http://magma.maths.usyd.edu.au/magma/download/x86_64-linux/

According to your process list that you posted, it looks like you use X11 with 
KDE plasma. You load up konsole, which starts bash and then you start magma.exe 
from there.

Likely it does sufficiently long computations that you need to leave it running 
for a while. That makes a lot of sense.

setsid(1) looks like a good tool for detaching magma from bash. Then you could 
safely close bash and the konsole and restart plasma and the X server demons 
(systemd services) every now and then so that you can free up that 50% plus of 
your 32 gigs of ram.

You had all those free up as much memory as rebooting the machine, but without 
having to interrupt magma with an actual machine reboot.

You could also accomplish this with tmux or screen, instead of setsid. You 
would load up Konsole and bash, start a tmux or screen session with a separate 
bash shell process in it, start magma, and then detach from the tmux or screen 
session.

Then you could safely exit Konsole, restart X and Plasma, launch a new konsole 
window, and reattached to that same tmux or screen session with magma running 
inside of it.

Would that work in your case?

On Sun, Nov 13, 2022 at 3:23 PM, American Citizen  
wrote:

> The setsid() command does exactly what I need when starting programs of
> this type
>
> See https://www.man7.org/linux/man-pages/man1/setsid.1.html about this
>
> Now, just to figure out a way to detach the parent from these children
> safely.

Re: [PLUG] trying to detach running processes - but how?

2022-11-13 Thread American Citizen
The setsid() command does exactly what I need when starting programs of 
this type


See https://www.man7.org/linux/man-pages/man1/setsid.1.html about this

Now, just to figure out a way to detach the parent from these children 
safely.





[PLUG] trying to detach running processes - but how?

2022-11-13 Thread American Citizen

Hi:

I did a quick look on the internet for how to detach a child process 
from the parent, but I am afraid that the present running condition of 
my tasks are such that disown does not work anymore, nor does nohup work 
upon starting the child to prevent the parent from really interrupting 
the child process and the child terminating. (despite what is stated, 
much to my big surprise this very thing happened, despite my starting 
the child command with nohup prepended)


Here's the current process tree (one example of several which are similar)

 PPID   PID  PGID   SID TTY  TPGID STAT   UID   TIME COMMAND
 1591  1602   993   993 ?   -1 Sl    1000   0:00  \_ 
/usr/bin/startplasma-x11
 1602  1680   993   993 ?   -1 Sl    1000 0:00  \_ 
/usr/bin/plasma_session
 1680  1771   993   993 ?   -1 Sl    1000 146:01  
\_ /usr/bin/plasmashell
 1771  4610   993   993 ?   -1 Sl    1000 0:21  |   
\_ /usr/bin/konsole
 4610  4661  4661  4661 pts/4 2327 Ss    1000 0:00  |   
|   \_ /bin/bash
 4661 20122 20122  4661 pts/4 2327 R 1000 1592:01 
|   |   \_ /usr/local/magma/magma.exe
 4661  2327  2327  4661 pts/4 2327 S+    1000 0:00  |   
|   \_ tail -f d1.results


My goal is to get processes 20122 and 2327 detached from 4661 
/usr/bin/konsole so that both are now attached to process PPID 1 (I believe)


How can this be done safely? My Plasma v5.24.5 desktop is suffering from 
leaky memory and has consumed 58% of my 32 gig memory so I am going to 
have to restart the desktop.


Sooner or later the Plasmashell IS going to consume ALL the system 
memory resources and finally crash the system.


Randall