Jump to content
The Uniform Server Community
Crypton

[FIX] db_backup.vbs - Type mismatch (Cdbl)

Recommended Posts

Hello everyone,

 

I'm here to report this error:

 

2ezgpi9.png

 

I've tracked the problem down, and it's caused by extra underscore characters in the database names. So this script doesn't support db names such as "my_fancy_db".

 

I've fixed the lines that were making the problem:

 

temp_array = split(objFile.Name,"_")		   'Get time stamp
If Cdbl(temp_array(1)) < Cdbl(ref_tim) Then	'Is this smaller than our reference (ref_tim)
 ref_tim = temp_array(1)

 

To:

 

temp_array = split(objFile.Name,"_")			  'Get time stamp
time_stamp = temp_array(UBound(temp_array) - 1)   'Now get the time stamp for real
If Cdbl(time_stamp) < Cdbl(ref_tim) Then		  'Is this smaller than our reference (ref_tim)
 ref_tim = time_stamp

 

I've attached the fixed script to this topic, I hope that it's permitted here.

Have a nice day. :)

db_backup.zip

Share this post


Link to post
Share on other sites

Thank you for posting I will add your fix to the next release. :)

 

Many thanks :)

Ric

Share this post


Link to post
Share on other sites

I'm happy to help, Ric. I've also made another modification, if you're interested.

 

I've added 'backup of backup' feature. It basically copies the created backups from the backup directory to user-specified locations that are specified in .ini file (semicolon separated). It's really helpful, if you... are paranoid. :) It's also possible to apply the same fifo rules, so the older backups will be deleted from those locations as well, if you allow it by setting UseFifo to true.

 

Example config:

[FIFO]

Fifo_depth = 3

 

[LOG]

Logging = true

 

[COPY]

UseFifo = true

Paths = D:\Backups;\\BackupPC\Backups

Changes that I made to "core_functions_inc.vbs":

Function us_dump_database_ex(db_name,dump_to_file,wait)
... Previous lines are unchanged
ExecCMD "cmd /c " & strCmd,0,wait			   'Run command hidden.
End Function

Function us_dump_database(db_name,dump_to_file)
Call us_dump_database_ex(db_name,dump_to_file,false)		 'Run command hidden. Do not wait to complete 
End Function

 

And the rest of the changes can be found in db_backup script, which I've attached to this topic, again. Cheers :)

db_backup.zip

Share this post


Link to post
Share on other sites

Edit: For some reason, I cannot edit my previous post. Anyway, here is new (fixed) version of that script from previous post. There was an issue with empty paths (Split problem).

db_backup2.zip

Share this post


Link to post
Share on other sites

I'm happy to help, Ric. I've also made another modification, if you're interested.

 

I've added 'backup of backup' feature. It basically copies the created backups from the backup directory to user-specified locations that are specified in .ini file (semicolon separated). It's really helpful, if you... are paranoid.

 

I'm paranoid and I'm looking for a better answer than backup of backup. I want REPLICATION with the slave on a removable usb attached disk. I have got 2 US apache-mysql running and can configure the master, but not the slave, with myphpadmin. Have you attempted this?

Share this post


Link to post
Share on other sites

Hello profl,

 

I actually also wanted db replication, but I was unable to setup the stuff around the redirection. My first server has dynamic IP so I'm using DDNS + CNAME record, but I don't know how to redirect to the backup server if the first one shuts down. If I understood correctly, the IP address of the backup server has to be specified in the A record for that domain address, but there is no A record for my first server, so it would redirect directly to the backup server, even if the first server is online. Is that correct?

 

So this backup of backup feature is for now enough for me, till I manage to setup the redirection stuff.

Share this post


Link to post
Share on other sites

Hello profl,

 

I actually also wanted db replication, but I was unable to setup the stuff around the redirection. My first server has dynamic IP so I'm using DDNS + CNAME record, but I don't know how to redirect to the backup server if the first one shuts down. If I understood correctly, the IP address of the backup server has to be specified in the A record for that domain address, but there is no A record for my first server, so it would redirect directly to the backup server, even if the first server is online. Is that correct?

 

So this backup of backup feature is for now enough for me, till I manage to setup the redirection stuff.

 

Crypton,

By running 2 instances of Uniform Server on the ONE computer, there is no need to address redirection. One instance running on the the C disk and the other running on a usb attached disk. Sure this will not give you failover if you crash, but your data is protected on the usb disk. The usb disk with uniform server and the replicated data can be attached to a new computer and you are up and running with no loss of data.

-drl

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...