this gets the process id for the background process you just ran
now sleep for 2 seconds and see if the process still exists
if you get this message that means the process died. If the process was meant to last longer, it is safe to come to the conclusion something went wrong. Now check the output file and see what happened.
deploy_cfg \
> $output_file &
pid=$!
sleep 2;
if [[ "`kill -s 0 $pid 2>&1`" =~ "No such process" ]];then
echo "$(cat $output_file)";
return 1;
fi