When I start up Linux Mint 19, I like to launch a few things. So I've been using a script (./get-to-work) in a MATE Terminal window to launch them all at once:
chromium-browser --start-maximized &
thunderbird &
code -n path/to/my/workspace &
That works great. I launch the script, close the terminal window, and the three programs continue running.
However, I recently added a line to open a big yellow window every five minutes (to remind me to sit up straight):
chromium-browser --start-maximized &
thunderbird &
code -n path/to/my/workspace &
for i in {1..1000}; do sleep 300 ; xterm -bg yellow -g 240x80 ; done
Now if I close the terminal I launched this in, the script is still running, and it gets killed, and then I don't get any yellow popups. That's actually a feature for me--I keep the terminal open as long as I want popups, and close it, for example, when I'm screen-sharing.
For whatever reason, though, closing the terminal and killing the script not only stops the popup loop, it now closes Chromium and Thunderbird too. VSCode (code) stays open. Why?
nohup thunderbird &should make the difference in the 2nd case. – Kamil Maciorowski Feb 27 '19 at 17:45(trap '' HUP; thunderbird &)– Feb 27 '19 at 18:47xterm -e sh -c 'sleep 3600 &'-- the sleep will be killed by SIGHUP despite it being adopted by init. – Feb 27 '19 at 19:28bash, other shells don't do that (only sleeping background processes will be sent CONT + HUP by the kernel). Also, onlyxtermis sending aSIGHUPto the fg process group in the terminal -- most other terminal emulators will just close the master side of the pty, causing aSIGHUPto be sent by kernel. – Feb 27 '19 at 19:37nohupandtraptricks both don't seem to work for keeping Chromium open, but they do keep Thunderbird going. – Kev Mar 01 '19 at 06:52setsid chromium &instead. – Mar 03 '19 at 16:43