Support

Akeeba Backup for Joomla!

#41151 is There A Post-Production Only Script?

Posted in ‘Akeeba Backup for Joomla! 4 & 5’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Environment Information

Joomla! version
3.9.20
PHP version
7.2.13
Akeeba Backup version
7.1.4 Pro

Latest post by JoeJoomla on Friday, 27 September 2024 09:12 CDT

JoeJoomla

EXTREMELY IMPORTANT: Please attach a ZIP file containing your Akeeba Backup log file in order for us to help you with any backup or restoration issue. If the file is over 10MiB, please upload it on your server and post a link to it.

Hi there,

Occasionally  a full backup fails to post process and since the full backups are large, the server can not have multiple local backup files.

Is there a specific script that can be run that does post-processing only? I know you can click a button to post process from the Manage Backups GUI interface but it would be good to be able to schedule something on a cron job since the hospital staff are not willing to check things manually because of the intense workload they already have.

Thanks!

 

Joe Sonne

 

 

 

nicholas
Akeeba Staff
Manager

We have plenty of CLI commands which, in true UNIX fashion, can be strung together to do something complex.

For starters, there's this https://www.akeeba.com/documentation/akeeba-backup-joomla/cli-command-reference.html#cli-backup-upload If you know the backup ID you can do something like php /path/to/cli/joomla.php akeeba:backup:upload 123 where 123 is the backup record ID.

But you want the last backup record, right? You can fetch it with this https://www.akeeba.com/documentation/akeeba-backup-joomla/cli-command-reference.html#cli-backup-list like so:

php /path/to/cli/joomla.php akeeba:backup:list --limit=1 --format=json --sort-by=id --sort-order=desc | jq '.[0].id'

Now, putting it all together in a script:

#!/usr/bin/env bash
backupid = $(php /path/to/cli/joomla.php akeeba:backup:list --limit=1 --format=json --sort-by=id --sort-order=desc | jq '.[0].id')
php /path/to/cli/joomla.php akeeba:backup:upload ${backupid}

There you have it. A CLI script to re-upload records which failed to upload automatically — as long as you make sure that the reason the upload failed is fixed before running the script, of course.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

JoeJoomla

Pretty impressive Nicholas,

Thank you for sharing your skills.

The reason for failed uploads, which is very infrequently, is due to an interruption or a timeout with the Amazon S3 connection. 98% of the time everything is fine.

If running the script results in no backup file being found because it was successfully post-processed and the script returns 'NULL' this should be OK? It doesn't really require a check to see if there is a file to post process does it?

if [ -z "$backupid" ]; then

echo "No backup found"
else
php /path/to/cli/joomla.php akeeba:backup:upload ${backupid}
fi

I'm not operating at CLI level that you are, not even close, so the question is coming from my very newbie level understanding. Also, I absolutely understand that my ability to Google or ChatGPT does not override your experience or insight on things like this.

Thanks again,

Joe Sonne

nicholas
Akeeba Staff
Manager

It should never return NULL because a latest backup is always present in your use case.

Remember that a backup record is created at the start of the backup. After the backup files are created, Akeeba Backup attempts to upload them. When they are not uploaded the backup record is marked Completed instead of Remote; that's all.

The commands I gave you will always find the latest backup, regardless of its status. When you try to reupload an already uploaded backup whose files are no longer present locally the second command will simply error out. You don't care about that.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

JoeJoomla

Much thanks Nicholas. I appreciate the good information.

Have a super day!

Joe Sonne

Support Information

Working hours: We are open Monday to Friday, 9am to 7pm Cyprus timezone (EET / EEST). Support is provided by the same developers writing the software, all of which live in Europe. You can still file tickets outside of our working hours, but we cannot respond to them until we're back at the office.

Support policy: We would like to kindly inform you that when using our support you have already agreed to the Support Policy which is part of our Terms of Service. Thank you for your understanding and for helping us help you!