Bug in backups sql

Hi guys

When checking the backup I saw that there were no backups made for a few days…
When seeing the file cd /var/log/hestia/backup.log

“Error: dump admin_xxxx failed”

The problem is that this database was deleted and no longer exists…
In other words, there may have been some “dirt” left in a file indicating that this database should be backed up.
Can anyone help me please?

Thanks

v-list-databases user

It happened with 2 databases. It said that the dump failed. The database did not exist, but hestiacp tried to back it up.
So I created and deleted these databases again to force hestiacp and not want to back them up.

Database “admin_0438” does not exist.
For some reason, when deleting a database via the hestiacp API using the "“v-delete-database” command, the db.log file seems to continue with the database in the list…

But now there is another error
2023-11-13 11:33:21 admin_0438(mysql)
sh: 0: getcwd() failed: No such file or directory
sh: 0: getcwd() failed: No such file or directory
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

v-delete-database should delete the record in db.conf

v-list-databases admin does show the deleted database?

Thanks for the answer

Until 11/03 everything was fine, that is, when using the command via API “v-delete-database” the db.conf was updated.

Today the system deletes/deletes databases in 2 ways. In the first way, I click on “delete”… when I delete a “system” "“v-delete-database” is called and everything is ok.
In the second way, a routine is executed via cronjob that can execute “v-delete-database” several times, one after the other.
It is inside a foreach, in the case after deleting a database and the return is “ok” the next database is deleted…

I honestly don’t know why in some situations it doesn’t delete in the db.conf file

“v-list-databases admin does show the deleted database?”
I’m not sure about that. I believe so, it is displayed

In that case probably the script that is called is wrong…

Without the code it hard to see what is going wrong…

The function that deletes the database is the same, but in the second way the function is called several times within a foreach…

Within foreach, it will only advance to the next iteration after the $returnDeleteDB of the correct deletion post has been returned?

Below is the function that deletes the database

// Prepare POST query
         $postvars = array(
"hash" => $this->vst_hash,
             "user" => $this->vst_username,
             "password" => $this->vst_password,
             "returncode" => "yes",
             "cmd" => "v-delete-database",
             "arg1" => $this->vst_username, //$username,
             "arg2" => $nameofdatabase,
             "arg3" => $db_user,
             "arg4" => $db_pass
         );
         $postdata = http_build_query($postvars);

         // Send POST query via cURL
         $curl = curl_init();
         curl_setopt($curl, CURLOPT_URL, "https://" . $this->vst_hostname . ":8083/api/");
         curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
         curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
         curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
         curl_setopt($curl, CURLOPT_POST, true);
         curl_setopt($curl, CURLOPT_POSTFIELDS, $postdata);
         $retornoBancoDadosDelete = curl_exec($curl);
         curl_close($curl);

         // database deleted
         if ($returnDeleteDB==0){
             return true;
         } else {
             return $returnDeleteDB;
         }

Syntax is

v-delete-database user user_databasename

And nothing more…

How ever it doesn’t mean the command fails.

It is the same command as the UI.

Try debugging the issue …

Thanks @eris

Do you say to replace the “cmd” parameter?

$postvars = array(
“cmd” => “v-delete-database”
);

for

$postvars = array(
“cmd” => “v-delete-database nameUser nameUser_databasename”
);

Would it be isso?
See that parameters arg1, arg2, arg3, arg4 have provided these parameters…
“cmd” => “v-delete-database”,
“arg1” => $this->vst_username, //$username,
“arg2” => $nameofdatabase,
“arg3” => $db_user,
“arg4” => $db_pass

No:

"cmd" => "v-delete-database",
"arg1" => $this->vst_username, //$username,
"arg2" => $nameofdatabase, // including username_ 

Thanks for reply

“arg2” yes include prefix username

Database is deleted but in CONF.DB row with database name is not delete…
If you do not backup, try to make a backup of the data bank continues in db.conf because the data bank has been effectively excluded (using API command “v-delete-database”)

“v-list-databases admin does show the deleted database?”
Yes, list database in conf.db and used “v-list-databases admin”. But the dice bank was previously excluded

I have noticed that this does not happen when we use the function to delete the dice bank by API.
However, when the dice bank is excluded, INSIDE A CRONJOB, it seems to me that this error occurs…

Would it be possible, to perform a backup of the database, for each data bank within db.conf, to effectively verify whether the bank exists?

For a better solution, check why this error occurred within a cronjob.
The error is: the database is excluded because the db.conf file is not updated, when used within a cronjob.

root@dev:~# v-add-database admin test test test 
root@dev:~# v-list-databases
Usage: v-list-databases USER [FORMAT]
root@dev:~# v-list-databases admin
DATABASE     USER         HOST       TYPE   DISK  SPND  DATE
--------     ----         ----       ----   ----  ----  ----
admin_18500  admin_18500  localhost  mysql  3     no    2023-10-26
admin_test   admin_test   localhost  mysql  0     no    2023-11-14
root@dev:~# v-delete-database admin admin_test
root@dev:~# v-list-databases admin
DATABASE     USER         HOST       TYPE   DISK  SPND  DATE
--------     ----         ----       ----   ----  ----  ----
admin_18500  admin_18500  localhost  mysql  3     no    2023-10-26
root@dev:~# 

If I run it via CLI it works fine

Try that first if that works…

As I can’t replicate the issue it is for use hard to guess what is wrong…

@eris
Thanks for help

I I discovered or made a mistake

It happened when there were 2 or more dice bank exclusions. The second time, it was successful except in Laravel or the connection cache and an error was generated, it was in loop = 2 because it was in the previous loop.
Despite giving error no loop 2 with dice bank loop 1, I was tempted to make queries with dice bank loop 1 (which had already been excluded), then giving error 500 per script and proceed to exclude the bank dice do loop 2.
I managed to solve the problem, but I don’t know why I excluded the data bank from loop 2 immediately, or db.conf was not updated

To clear the cache data use DB::purge

Obrigado hair support