I am trying to captuer the actual error of the perl script if it fails. And its not stopping and the next script is getting triggered.
UPDATED Python scripts are running fine only having problem with the perl script
if ! perl test.pl arg2 arg1 ;
then
echo "Error running test.pl in Preparing data for algorithm; rest of process stopped." >&2 >>$LOG_PATH/Perl_RUN_$TRACK_TIME
elif ! python themes.py;
then
echo "Error running themes.py rest of process stopped." >&2 >>$LOG_PATH/Python_RUN_$feed_name'_'$TRACK_TIME
elif ! python $SCRIPT_PATH/pre_survey_dt.py;
then
echo "Error running pre_survey_dt.py rest of process stopped." >&2 >>$LOG_PATH/Python_RUN_$TRACK_TIME
fi
Please advice what I am missing here.
if ! perl test.pl arg2 arg1; then
echo "test.pl failed with error code $?" >&2
exit 1
fi
Use return
instead of exit
:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.