I am using Korne Shell in HP-Ux. Can someone give me and idea on how I can write a shellscript on how to do this please:-
On our HP-UX server, a batch file is run every evening at about 6:30pm. The first step of this batch file will touch an empty "flag" file to indicate that the batch has already started running. This flag is removed at the end of the evening batch file. So bascially, as long as this flag exists, the batch file is not allowed to be run by another operator. The problem is I need to built in some testing that if the batch file has already been run once within the 24 hours cycle, it mustn't be run again.
I thought about setting a timestamp into the "flag" file I create at the beginning of the batch run and call it "BatchRunning". Then rename this flag file and call it "batchRan" so it will be served as sort of time marker for comparison later. So if the batch file is re-run then a comparison can be made between the two files "BatchRunning" and "batchRan". If "BatchRunning" is less than "batchRan" by 24 hours then abort the batch file immedately and display a message to the operator.
So that's the theory, how do I script this in Korne Shell please??
Please help me ... as I have tried to search the forum for clues .... and I am really stuck now..
In my search, on time comparison, it picked up the "datecalc" script but I am not sure if it can be applied to my problem ( it looks far too complicated).
Many thanks in advance,