Confirming backups have completed
a good while back I had written a script that worked with the legacy backup system to automatically rotate backup folders. In that script I was used `find /usr/local/cpanel/logs/cpbackup/ -mmin -600` to confirm a log file was created for today's backup. Then it checked the last 2 lines of that log file for "Completed" to confirm the backup had finished. This worked because logs for successful backups ended with a string like "[cpbackup] Completed at Tue Oct 21 01:25:45 2014"
I've been using the new backup system for a while now in place of my script, but have come across the need to write another script for a different purpose. Again I need to be able to tell if the backup has completed successfully, and I just noticed the New Backup system does not appear to finish the logs with the same completed message. I've been looking through backup logs over the past year and they all just stop after the last account that was backed up.
Is there a way with the new backup system that I can confirm a backup has run and completed successfully?
Thanks,
Nathan
-
It is sending an email when done. Or at least with me 0 -
It does send me an email, but I need a bash script to confirm the backup has finished before it moves on. 0 -
Hello, I think there is simple way to run your won backup scripts after the cPanel backup scripts. For this you will have to create /scripts/postcpbackup scripts and enable this backup hook through WHM "Development "Manage Hooks so that your /scripts/postcpbackup script will be run automatically when your cpanel backup is completed. 0 -
Hello :) You could use an event hook to run a script at the completion of the backup process: Guide to Standardized Hooks You can register a hook after creating the script with a command such as: /usr/local/cpanel/bin/manage_hooks add script /root/post_backup --category System --event Backup --stage post
Thank you.0 -
In my case the script i'm creating will actually be ran from a remote server so it cannot be called directly by the post backup hook. But with that information i can write the post_backup script to touch a file and monitor that file from my remote script and i think that will get me where I need to be. Just one follow up question, is there any condition where we fail to create a successful backup but the post backup script still gets triggered? Thanks for all the info/help -Nathan 0 -
]Just one follow up question, is there any condition where we fail to create a successful backup but the post backup script still gets triggered?
The hook should happen after the backup process completes, regardless of if an account backup fails to generate. It's rare that a backup generation fails, so it's something that should be addressed to determine why it happens. Thank you.0
Please sign in to leave a comment.
Comments
6 comments