get status of previous command
We may need to know the status of previous command sometimes. Whether this is successed or this is failed.According to teh situation we may need to perform some operation.So for this we need to understand whether our command ran successfully or not.
Here you go
nohup bash $Script_Path/scripts/Customer_Trans.sh
EXIT_STATUS=$?
Now the status is in EXIT_STATUS . This will be 0 if the process ran successfully.
if [ $EXIT_STATUS != 0 ]
then
echo "Automatic reconciliation process failedat : `date +%Y%m%d` ." | mailx -s "Monthly Reconcilation" $Mail_ID
else
echo "Automatic reconciliation process successfully ended at : `date +%Y%m%d` ." | mailx -s "Monthly Reconcilation" $Mail_ID
fi
Here you go
nohup bash $Script_Path/scripts/Customer_Trans.sh
EXIT_STATUS=$?
Now the status is in EXIT_STATUS . This will be 0 if the process ran successfully.
if [ $EXIT_STATUS != 0 ]
then
echo "Automatic reconciliation process failedat : `date +%Y%m%d` ." | mailx -s "Monthly Reconcilation" $Mail_ID
else
echo "Automatic reconciliation process successfully ended at : `date +%Y%m%d` ." | mailx -s "Monthly Reconcilation" $Mail_ID
fi
Hope this is clear to you .
Comments
Post a Comment