How to reschedule job if failed with some exit status

#1

Hi,
i need to restart jobs which has failed due to license error , i have found job exit status is 2 , any suggestion

#2

suppose a job is running but not getting license and when it fail to get license we will identify and rerun job again , is this possible by any chance