Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
As a rule of thumb child processes are terminated when their parent process ends.
And to follow up with better detail, running a command with & at the end is just forking off the /bin/bash shell process when logged in, this is why it dies if you logout. Use screen or the nohup if you desire to logout before the command finishes.
Many shells have a "logout" script the runs after you logout. I use these to usually clear the display.
Tcsh and Csh have /etc/csh.logout.
Zsh has /etc/zlogout
I don't know about bash/ash, and I deny the existance of ksh since it doesn't have a nice prompt.
You can also use the "at" daemon to do stuff for you whenever. I've even upgraded an Openssh server , including restart, while logged in by that Openssh server.
Ex:
# at now + 2 minutes
at>(do something)
at>(do something else)
#
# logout
2 minutes later...(stuff)
I think also the "disown" command will let you logout while the process stays in the background (for Zsh).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.