Output: You will be getting an email alert similar to below. shell_exec ("my_script.sh 2>&1 >> /tmp/mylog &");?> Code snippets and open source (free sofware) repositories are indexed and searchable. Using nohup command to Keep Running SSH Sessions. Use nohup or disown if you want a background process to keep running forever.. The nohup command executes another program specified as its argument and ignores all SIGHUP (hangup) signals. If you are not that familiar with screen or tmux, you can use nohup and send your long running command to background so that you can continue while the command will keep on executing in background. Some additional info: nohup is a program you can use to run your application with such that its stdout/stderr can be sent to a file instead and such that closing the parent script won't SIGHUP the child. The background process (AKA daemon) inherits all the file descriptors of the parent, including the writing side of the stdout/stderr pipes that connect the child process and Jenkins. However, you need to have had the foresight to have used it before you started the application. Because of the way nohup works, you can't just apply it to a running process. Some advantages and features of Rsync command. To run a command in the background using the nohup command, type: nohup command & The command output is redirected to the nohup.out file. Commands marked • are bash built-in commands. The utility can recover the original file even if one of the component files is lost. And for them, here is your Kali Linux commands cheat sheet, take a copy of the Kali commands pdf along with this article for your reference in future. To run a command in background, the output must be redirected to /dev/null. You don’t need to be root user to run rsync command.. searchcode is a free source code search engine. Redirecting the output to a file like this didn't work for me: