Bug 97680

Summary: Protect shells from unintentional closing them or killing important jobs
Product: [Applications] konsole Reporter: Frank Hellmuth <fhellmuth>
Component: generalAssignee: Robert Knight <robertknight>
Status: RESOLVED FIXED    
Severity: wishlist CC: bluedzins, robertknight
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:

Description Frank Hellmuth 2005-01-22 23:00:16 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources

Sometimes you start a long time running process in a shell. You continue to work in other konsoles and after some time human beings getting tired... :( . It's easy to loose track of multiple tabs in several separate konsoles. So it would be nice to

1) have a reminder (besides that there are multiple konsoles open), when you close a konsole that there are still *running* jobs in a different tab (that should be easy to implement if there are still running childs of that shell) and present them to the user.

2) have the posibility to lock a console (from a maybe very tired) user, by locking the keyboard for that specific tab, to prevent users to give the wrong process a "Ctrl-C". That should also be not that hard to implement (maybe give the window additionally a "alarming" background colour).

A more sophisticated way could be to have the possibilty to detach a tab from a console to another specially protected one for "important jobs", with all the nice things you could do with this approach, like having a special alert if one of these processes end with exit status != 0, renicing these jobs automatically, etc...

You know these nights when you work hard all night just to get you thesis/talk/... done before deadline and then you kill accidentally your calculation job just 10 minutes before the 6 hour process would have finished... :(
Comment 1 Thiago Macieira 2005-01-24 02:33:09 UTC
1) There's no way of telling if a process has children processes running. Not portably, anyways. The only solution is to keep running /bin/ps and hope it has tree-like output formatting.

The rest seems feasible.
Comment 2 Kurt Hindenburg 2005-06-09 19:44:57 UTC
Perhaps doable using /proc (which is Linux 2.6.x only I think).

$ dcop konsole-944 session-1 sessionPID
952
% ls /proc/952
auxv     cwd@     exe@  maps  mounts   oom_score  stat   status  wchan
cmdline  environ  fd/   mem   oom_adj  root@      statm  task/

# Find all children of 952  (I'm running kdesvn-build on session-1)
% /bin/ps --ppid 952
  PID TTY          TIME CMD
15157 pts/3    00:00:00 kdesvn-build
Comment 3 Robert Knight 2006-08-08 06:01:08 UTC
> There's no way of telling if a process has children processes running. 
> Not portably, anyways. The only solution is to keep running /bin/ps and 
> hope it has tree-like output formatting.

I wrote code to do this, and it met a few roadblocks so it was disabled.  Having read this wishlist though it might be worth adding it as an option.
Comment 4 Frank Hellmuth 2009-01-15 15:32:24 UTC
Seems finally implemented in the current SVN Version. Thanks, closing the bug! One less for the statistics ;)
Comment 5 Maciej Pilichowski 2009-01-15 15:43:55 UTC
Absolutely fantastic news! Thank you all.
Comment 6 Jekyll Wu 2011-07-31 14:10:23 UTC
*** Bug 159456 has been marked as a duplicate of this bug. ***