How to determine if restoration is finished successfully from admin_backup

MaXi32

Verified User
Joined
Jul 25, 2016
Messages
659
Location
The Earth
I want to determine if the backup restoration has finished successfully from the admin_backup via script or command line.

I can execute restoration via API and there is no problem with it. In the current DirectAdmin 1.63.0, when I do restore via API or GUI, it will just add the restoration command to task.queue so the script will just exit with return success (the problem here is, the restoration process that is being executed by taskq might be failed and there is no error code that can be obtained here on restoration).

This is the text that will appear after we execute restore where it will just add this restoration process in task q, leaving the script as success return code:

Code:
text=Restores added to Queue
details=You will be notified via the Message System when the process is complete

If the API did not use task queue then I think this will not be the problem.

One funny way how I determine restoration has finished is, I would read the restoration command in task.queue that has the word "action=restore". If this line is empty, then I can say that restore is finished.

But with this method, I will not be able to detect if the restoration has an error. What would be the most efficient way to do this? I could not find this in the forum.

Or maybe, the question should be wording like this:

is there a way to prevent DA admin_backup restoration from being added to task.queue and just execute it right away when it is called and get the return success / failed for the restoration? The restoration might be delayed in the script but I can wait until I get the correct restoration return code / status when it is finished.
 
Last edited:
Thinking about reading the success message from the ticket system using API but this is a silly idea. If anyone can help with another idea really appreciate it.
 
Last edited:
Successfully did that reading from the ticket system using while loop, if the text "Your User files have been restored" is coming then this seems to be a success.

Based on the ticket system, when restoration has error (example corrupt zip):

1635049236664.png

When restoration has no error based on the message from the ticket:

1635049400410.png


It's a weird workaround but it works at this moment.

Maybe @scriptkitty expert on this and can have a better idea of how to determine if backup restoration on admin_backup is completed with correct return code.
 
Last edited:
Back
Top