We have a long running process on a remote server which is kicked off manually from time to time. Unfortunately internet connections die, kernels panic and a whole host of other challenges can be encountered by the ssh session used to connect and start the job.
Screen seems like a perfect way to ensure the process isn't interrupted. However, relying on a person to always remember to start screen and then run the script to start the process is a problem waiting to happen. Is there a way from the script I can check to see if the script is being called from within screen? If it is the process will continue otherwise the script will exit with a message instructing the user to run screen first.