Support

Akeeba Backup for Joomla!

#40551 Reset Joomla Schedule for Backup Profile (CLI-only job)

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
5.0.3
PHP version
8.2.7
Akeeba Backup version
9.9.0

Latest post by dsic-se-support-web on Tuesday, 16 April 2024 04:31 CDT

dsic-se-support-web
Issue - Reset Joomla Schedule for Backup Profile (CLI-only job)

Context : For reasons, we do not use the Site Transfer Wizard to restore .jpa backups on a different machine: our systems are not allowed to communicate. We use the CLI UNITE tool with a configuration file instead.

Context #2: All Joomla Scheduled Tasks are run by cron-calling joomla.php. Several registered scheduled task are present, added by Akeeba itself (Schedule Automatic Backups -> Joomla Scheduled Tasks).

We want the schedule to be reset after restore.

The scheduled task for the Main Profile (a Full Backup) shall run at the earliest opportunity, not on the normal Nth day (once every 30 days for instance P30D) = (Field "jform_next_execution" in the WebUI)

We still want the job to run at its scheduled time (e.g. 5.30 am).

 

Is there a way to do that by using the CLI exclusively (WebGUI would be a plus), and not doing any manual SQL fiddling? Obtaining the ID number in CLI for any profile is a solved problem for us.

 

Best Regards

Marc

 

 

 

 

 

nicholas
Akeeba Staff
Manager

Kindly note that Joomla! Scheduled Tasks are managed and executed by Joomla! itself. We have no say on that code. You probably need to read https://www.akeeba.com/documentation/akeeba-backup-joomla/automating-your-backup.html#joomla-tasks-danger-ahead to understand the caveats of using Joomla! Scheduled Tasks.

Instead of using scheduled tasks you can just use the standard CLI backup command, see https://www.akeeba.com/documentation/akeeba-backup-joomla/automating-your-backup.html#native-cron-script Since you will be scheduling this with your server's CRON it will always run on the specific time you have configured.

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!

dsic-se-support-web

Thanks Nicholas,

We have successfully triggered a manual backup as recommended, using the `akeeba:backup:take` command, and it fits our needs for the time being.

 

Two questions though:

  1. We do not wish to set it as a regular cron task because it would be considered as micromanaging the schedules. It runs counter to the point of J! scheduled tasks IMHO. The problem that remains is when manually-triggering the job, it has no bearing on the next scheduled Joomla task execution => no best of both worlds here :( Could we request a feature enhancement?
  2. Tangentially related, we set the "obsolete records to keep" to a non-zero value in the profiles. Yet what is observed is old, marked as obsolete records which are also older than the "maximum backup age" are not removed from the database in "Manage Backups". Regardless of whether they've failed or not

I think it has to do with the output_filename (Archive template name) based on timestamps

 

 

 

 

nicholas
Akeeba Staff
Manager

1. Scheduled Tasks and their rescheduling time is handled by Joomla. We have no say on that code. Therefore, we cannot do anything about it.

Here's the thing. Joomla Scheduled Tasks DO NOT guarantee that a task will be executed at a specific point in time. It's contrary to its concept. It only guarantees that a task will eventually run sometime after the predefined execution time, if and only if there is a functional trigger mechanism for Joomla Scheduled Tasks (CLI CRON, web URL, lazy scheduling) which dutifully triggers Joomla Scheduled Tasks' evaluation often enough for all scheduled tasks to execute correctly. CRON jobs always run at the time you specified.

Joomla Scheduled Tasks DO NOT guarantee that rescheduling will result in a predictable date and time unless you use the CRON Expression scheduling method. Using settings like Daily provides zero guarantees. For example, Daily only means that the task will be rescheduled to run 24 hours after it's finished, whenever that is. Since tasks have a non-zero execution time the rescheduling will make them time-shift on every execution. CRON jobs are always rescheduled using the CRON job settings.

Therefore, if you want to have guaranteed task execution and rescheduling time you must use CLI CRON jobs with your host. It's a matter of using the right tool for your use case.

Let me put it this way. CLI CRON jobs are cars. Joomla! Scheduled Tasks are busses. When you use your car you can always get in it at the same time every day, and arrive to your destination at around the same time. If there's a traffic issue along the way you can reroute instead of being stuck in traffic forever. It's predictable to a very high degree. When you take the bus it will eventually come, assuming there's no strike or the badly maintained bus broke down again, but it won't be exactly the same time every day. It will eventually take you to your destination, maybe, unless it breaks down, or there's a strike midway through your journey, or there are too many people getting on and off the bus, or there is a traffic issue within its predefined and inflexible route. If you want to always leave your house on time and be on time, you use the car, not the bus. Expecting the bus to always be on time and predictable is asking for too much.

2. Obsolete records are removed per backup profile when their number exceeds the configured value for that setting. That's the only control you have.

Day-based backups quotas control when your backups archives will be removed, either from your web server or your remote storage depending on the quota type. They do not control removal of obsolete records. They may cause a record to become obsolete, but they won't remove it, and this is by design.

The maximum backup age setting in the backup notification quick icon is only used to determine when you have not taken a backup in a while, based on the backup records in your database. It does not modify or remove backup records.

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!

dsic-se-support-web

OK, let's mark this resolved as wontfix

 

We will open a new ticket second for the second point as it probably deserves its own feature request issue.

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!