Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome General
 PowerHome Messageboard : PowerHome General
Subject Topic: Database Backup Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
doctorjerry
Groupie
Groupie


Joined: November 10 2007
Location: United States
Online Status: Offline
Posts: 57
Posted: January 09 2008 at 18:18 | IP Logged Quote doctorjerry

As a new Powerhome user and nonprogrammer, please explain every step for me to simply backup the database without closing down the program.

I found the following reference,which seems in the ballpark, but I have no idea where this command is executed. Is it a dos level command, or perfomed within powerhome. And if this is the command, I still need help with all the parenthesis'.

ph_backupdb ("C:\HA\PowerHome\Database\Backups\phdbbackup." + string (year (today ())) + string (month (today()), "00") + string (day (today()), "00") + ".db", 0)

Sincerely,

Jerome



__________________
Jerome
Back to Top View doctorjerry's Profile Search for other posts by doctorjerry
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: January 09 2008 at 20:41 | IP Logged Quote TonyNo

That is a formula that can be put into a macro to be executed automatically which will create backups with a file name that contains the year, month, and day it was run. It backs up up the database to the folder specified, which is C:\HA\PowerHome\Database\Backups. The last parameter, which is zero, means to not overwrite an existing file, if it exists.

A more simple version to just backup to a single file in the root of your c drive each time called would be...

ph_backupdb ("C:\phdb.db", 1)

Creating a macro with either of these is easy...

Launch the PowerHome Explorer (Maintenance, Explorer, or click the E icon in the PowerHome toolbar), navigate to the Macros section in the left pane, right-click in the right pane, select Insert, type in a macro a name (like backup), type in a Description (like backup database) and click Refresh (lightning bolt icon in the Explorer toolbar).

Now, find and click on this new macro in the left pane, move over to the right-pane, change the Command to Formula, make the Value Post, enter one of the formulas into the Send Keys box, then click refresh.

Now, when you want to backup the database, you can select the backup macro in the Macro/Formula drop-down and click Run.
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
doctorjerry
Groupie
Groupie


Joined: November 10 2007
Location: United States
Online Status: Offline
Posts: 57
Posted: January 10 2008 at 11:03 | IP Logged Quote doctorjerry

Tony,

I created a macro in the macros window as follows
ID = BACKUP
Description = Database Backup

In the Macro Detail windows as follows
Command = Formula
Data = left blank
ID = left blank
Value = Post
Send Keys = ph_backupdb ("C:\phdb.db", 1)

Ran the macro but no file phdb.db is created in c:\

__________________
Jerome
Back to Top View doctorjerry's Profile Search for other posts by doctorjerry
 
jeffw_00
Super User
Super User


Joined: June 30 2007
Online Status: Offline
Posts: 929
Posted: January 10 2008 at 18:40 | IP Logged Quote jeffw_00

I wrote a really short perl script that copies the backed up db file to a unique name, and call the script from SH as part of the backup macro. Then I created a control panel button that triggered the macro.

One click, and I get a unique backup.

just a thought
/j
Back to Top View jeffw_00's Profile Search for other posts by jeffw_00
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: January 10 2008 at 19:50 | IP Logged Quote TonyNo

Based on your saying it didn't work, I checked my c drive and I have no backups! I have been using this forever, but it looks like it stopped working about 1.5 years ago! I need to add some code to make sure the backup happens.

The formula evaluated to a 5 which means "the backup file rename operation fails".

If I change the path to be out of the root of C, it works.

Dave, does this make sense?
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
ginigma
Senior Member
Senior Member


Joined: June 18 2006
Location: United States
Online Status: Offline
Posts: 127
Posted: January 10 2008 at 20:59 | IP Logged Quote ginigma

Here's what I use in a timed event:

ph_backupdb ("C:\HA\PowerHome\Database\Backups\phdbbackup." + string (year (today ())) + string (month (today()), "00") + string (day (today()), "00") + ".db", 0)


__________________
Insteon (40 devices) ^ PowerHome (435 links) ^ Logitech Harmony 880
Back to Top View ginigma's Profile Search for other posts by ginigma Visit ginigma's Homepage
 
krommetje
Super User
Super User
Avatar

Joined: December 29 2004
Location: Netherlands
Online Status: Offline
Posts: 695
Posted: January 11 2008 at 05:46 | IP Logged Quote krommetje

TonyNo wrote:
The formula evaluated to a 5 which means "the backup file rename operation fails".
If I change the path to be out of the root of C, it works. Dave, does this make sense?


I have the same problem as TonyNo

Peter
Back to Top View krommetje's Profile Search for other posts by krommetje Visit krommetje's Homepage
 
doctorjerry
Groupie
Groupie


Joined: November 10 2007
Location: United States
Online Status: Offline
Posts: 57
Posted: January 11 2008 at 13:09 | IP Logged Quote doctorjerry

Glad to see such interest in what I thought was a simple problem.
All suggested formulas worked as long as it's not c: drive.
Hope I don't have to learn Perl script to use the program, but if I do I'll get back to you Jeff.

If have other unrelated questions. Should I continue on this thread, or create a new one for each question?

Jerry

__________________
Jerome
Back to Top View doctorjerry's Profile Search for other posts by doctorjerry
 
cmhardwick
Senior Member
Senior Member
Avatar

Joined: July 08 2006
Location: United States
Online Status: Offline
Posts: 290
Posted: January 11 2008 at 13:33 | IP Logged Quote cmhardwick

New threads, to keep it simple to track

__________________
Cicero, Enjoying automation!
Back to Top View cmhardwick's Profile Search for other posts by cmhardwick Visit cmhardwick's Homepage
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: January 15 2008 at 15:27 | IP Logged Quote dhoward

Tony,

I know this used to work so it looks like it may be a bug that was introduced with the upgrade from ASA 6 to ASA 7. I'll check into it and make sure it gets squashed.

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum