How to automaticly start process if process was killed or finished Linux Ubuntu 18.04? For example I've got process name Test, that process was killed because some problem... I need to automaticly start that process with screen command. I need a script for that, but porcess should start with screen command, and cron have to check it every 5 minutes.
You can set up a cron to check if process running or not every 5mins.
*/5 * * * * bash /tmp/check_process.sh
and in check_process.sh check if process is running or not. If not running then start the process.
#!bin/bash
pgrep -x {process-name}
if($? != 0 )
then
screen -d -m {process_start_command}
fi