I'm practically new in bash scripting and still in learning process but I have trying to achieve relatively simple task but beyond my understanding.
I have output file with identifier, name of the machine and configured time of the MySQL dump which look like:
id;server.name;time_in_hour
for every single line of the file.
What I need is for loop which compares "time_in_hour" with timestamp of files in "server.name" folder on backup machine. Path to the backup files looks like:
/dumps/server.name/2020-05-06___10-49-00___sys.sql.gz
If there isn't backup files of max. time length 2x "time_in_hour" (example: actual time -4 hours, for every dump file in folder with 2 hours backup schedule) or if there isn't backup at all, than script will print error to output. In ideal case second condition of the script check end of every dump file for consistency, something like grep string "Dump completed".
End of a dump file example:
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS /; /!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION /; /!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2020-03-02 23:58:29
I'm still not completely sure which tools is better for accomplishing the task "date" or "find"? Or how to practically build this type of ?nested loop? with multiple condition... can you please provide me some example?