rsync after backup ends
Hello,
I am trying to do an rsync after the cpanel backup ends. I am using the new backup system for cpanel and not the legacy. I am having trouble finding documentation on the new backup system.
In the legacy backups you would add POSTBACKUP 1 TO /etc/cpbackup.conf file
and add the rsync command to the file /scripts/postcpbackup to run the command after cpanel backup got finished.
In the new system the backup conf file is in /var/cpanel/backups/config
I changed POSTBACKUP: 'no' to POSTBACKUP: 'yes' .
What is not clear to me is if we should call /scripts/postbackup instead of /scripts/postcpbackup for the new post backup file to be called after cpanel is done.
I read this on another post, but don't know where to start:
The new backup system uses the standard hook system we introduced in 11.32. Through that, bin/backup exposes both a pre and a post hook event.
I am not seeing the documentation for bin/backup and pre/post can someone point me in the right direction please?
-
From backup script "/usr/local/cpanel/bin/backup", you can find this: /usr/local/cpanel/scripts/postcpbackup if ( -e '/usr/local/cpanel/scripts/postcpbackup' && -x _ && ( !exists $$conf_ref{'POSTBACKUP'} || $$conf_ref{'POSTBACKUP'} ) ) { $logger->info("Executing user defined post backup script (/usr/local/cpanel/scripts/postcpbackup)."); system '/usr/local/cpanel/scripts/postcpbackup'; }0 -
I am assuming the script above is in pearl. I am not familiar with pearl, but what it looks like is that postcpbackup should be ran after the cpanel backup process is over. What I have in /usr/local/cpanel/scripts/postcpbackup doesn't get run after I do a backup. Is there something else I should do to make the if statement run true? I am not sure what -x _ is for and I have both config files for set for true for legacy and new backup. if ( -e '/usr/local/cpanel/scripts/postcpbackup' && -x _ && ( !exists $$conf_ref{'POSTBACKUP'} || $$conf_ref{'POSTBACKUP'} ) ) { $logger->info("Executing user defined post backup script (/usr/local/cpanel/scripts/postcpbackup)."); system '/usr/local/cpanel/scripts/postcpbackup'; } Is there something I need to restart so the config files are updated in the config cache? 0 -
Hello :) You can register a hook after creating the custom script you want to run after backup generations with a command such as: /usr/local/cpanel/bin/manage_hooks add script /root/post_backup --category System --event Backup --stage post
This assumes your script is located at /root/post_backup. Thank you.0
Please sign in to leave a comment.
Comments
3 comments