I have a really old console application that I want to make a bit more resilient. The program is used this way:
- the user uses a custom terminal emulator to connect to a remote machine through ssh
- the user starts a shell script
- the shell script might start a long-running progress database process.
Obviously, sometimes users simply lose the ssh connection to the machine, and in this case, the ssh session is terminated, the shell script running inside is terminated, and finally the progress database process is terminated as well. In like one case out of a thousand this causes corruption in the database, so I'd like to prevent it from happening.
What I tried so far:
- starting a screen or tmux session before starting the shell script - this doesn't work because the application needs the TERM variable to be set to at386 (and it bypasses termcap/terminfo completely... ugh...)
- nohup/disown the progress process - this doesn't work because the shell script and the progress process are continuously communication with each other in obscure ways it seems
Any other idea of how to make sure that the progress process doesn't terminate when the ssh session is killed?