0

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.

  • What are you trying to do? What dates are you processing. It is hard to understand what you are asking, so you are unlikely to get a good answer. Please improve your question. Also no need to comment, yourself. – ctrl-alt-delor Sep 24 '18 at 18:02
2

To indicate success, you can create the file with touch my_script_success

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 touched.

  • @Vas please remember to accept this answer if it's the one that works for you. (Use the tick mark beside the up/down votes.) – roaima Sep 24 '18 at 22:28

Not the answer you're looking for? Browse other questions tagged or ask your own question.