How To tell if a script was run in the background ?
The ps utility can get the process state. The process state code will contain the character + when running in foreground. Absence of + means code is running in background. However, it will be hard to tell whether the background script was invoked using nohup. It’s also almost impossible to rely on the presence of … Read more