I have a script which ensures that the process keeps on running and the output of the process are being redirected to corresponding process_name.out files.
Mysteriously (for me atleast), the output doesn’t get redirected to the file unless I close down the script though the error does.
Any clues in this regard would be really helpful.
#!/bin/bash
until $1 >> "/root/$1.out" 2>>"/root/$1.log" ; do
echo "Server $1 crashed with exit code $?. Respawning.." >> "/root/procees.log"
sleep 1
done
The solution as @shelter mentioned in one of the comments is to use
instead