I want the script to create a file with the last successful run time and also the script should extract the last success run time for the consequent executions. This is useful if the script fails for some reasons and it picks up the dates for the next run.
To indicate success, you can create the file with
To see when the last successful run was, you can use
stat --format=%Y my_script_success.
stat will exit with an error if the file doesn't already exist, otherwise you get the modification time, which would be the time the file was last