Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome General
 PowerHome Messageboard : PowerHome General
Subject Topic: PH Crashed due to Event Log blockage Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
GadgetGuy
Super User
Super User
Avatar

Joined: June 01 2008
Location: United States
Online Status: Offline
Posts: 942
Posted: December 24 2012 at 08:56 | IP Logged Quote GadgetGuy

For the last day PH has quit executing anything in the
Execution Queue. If I clear it, it just backs up again as
timed or triggered events occur.

First I attempted to rebuild the database using phupg.exe
but it becomes non-responsive when it hits the EventLog
compression process, forcing me to Terminate the process.

I then attempted to execute ph_trimeventlog(1) from
within PH, but that process freezes also.

At this time I appear to be dead in the water with a
corrupted db.

Any ideas of how to break out of this jam?


__________________
Ken B - Live every day like it's your last. Eventually, you'll get it right!
Back to Top View GadgetGuy's Profile Search for other posts by GadgetGuy
 
GadgetGuy
Super User
Super User
Avatar

Joined: June 01 2008
Location: United States
Online Status: Offline
Posts: 942
Posted: December 24 2012 at 09:59 | IP Logged Quote GadgetGuy

Fixed it!

Restored backup database made several days before, and
then
rebuilt changes I had made in the interim.

In doing so discovered that one change had inadvertently
created an infinite loop in a macro. That macro was
called
by a number of Timed Events so was locking up everything.

After correcting that issue, all is once again good in
Oz.


The Moral of the Story is . . . "It is good to make
frequent backups!"

Edited by GadgetGuy - December 24 2012 at 10:00


__________________
Ken B - Live every day like it's your last. Eventually, you'll get it right!
Back to Top View GadgetGuy's Profile Search for other posts by GadgetGuy
 
krommetje
Super User
Super User
Avatar

Joined: December 29 2004
Location: Netherlands
Online Status: Offline
Posts: 695
Posted: December 24 2012 at 10:17 | IP Logged Quote krommetje

You can download a database editor and delete manually what is wrong but you have to know what you're doing, just google on it.... there are loads of editors available.

I make an automated backup every day at 23:00hrs and do not delete the backups for 2 weeks. Once a month I upload a backup to a cloud... backup is SO important!!!

Peter
Back to Top View krommetje's Profile Search for other posts by krommetje Visit krommetje's Homepage
 
GadgetGuy
Super User
Super User
Avatar

Joined: June 01 2008
Location: United States
Online Status: Offline
Posts: 942
Posted: December 24 2012 at 12:52 | IP Logged Quote GadgetGuy

Peter-

I would love to run an automated backup but never figured
out an easy way to do it, because the file is open when
PH is running and won't copy.

Do you run a script that stops PH, backs up the db and
then restarts PH or have you figured out an easier way?

If you run a script, would you consider posting it? It
would help a lot of people, I suspect!



Oh yes and "Dank u en Merry Christmas!"

Edited by GadgetGuy - December 24 2012 at 12:54


__________________
Ken B - Live every day like it's your last. Eventually, you'll get it right!
Back to Top View GadgetGuy's Profile Search for other posts by GadgetGuy
 
BeachBum
Super User
Super User
Avatar

Joined: April 11 2007
Location: United States
Online Status: Offline
Posts: 1880
Posted: December 24 2012 at 14:16 | IP Logged Quote BeachBum

Here's mine...

insert into macroheader values ('BACKUP','BACKUP DATABASE',0,0,1);
insert into macrodetail values ('BACKUP',1,38,'',1,'PH_BACKUPDB ( "C:\PH\BACKUP\PH_OFFICE.DB", 1)',0,'','');
insert into macrodetail values ('BACKUP',2,38,'',0,'ph_copyfile("C:\PH\BACKUP\PH_OFFICE.DB" , "C:\PH\BACKUP\PH-OFFICE"   + " " + string (month (today())) + "-" + string (day (today()))+ " " + string (hour(today())) + string (minute(today())) + ".DB", 9)',0,'','');
insert into macrodetail values ('BACKUP',3,38,'',1,'ph_copyfile("C:\PH\BACKUP\PH_OFFICE.DB" , "P:\PH-OFFICE"   + " " + string (month (today())) + "-" + string (day (today()))+ " " + string (hour(today())) + string (minute(today())) + ".DB", 9)',0,'','');
insert into macrodetail values ('BACKUP',4,38,'',0,'ph_copyfile("C:\POWERHOME\PWRHOME.INI", "C:\PH\BACKUP\PH"   + " " + string (month (today())) + "-" + string (day (today()))+ " " + string (hour(today())) + string (minute(today())) + ".INI", 9)',0,'','');
insert into macrodetail values ('BACKUP',5,38,'',0,'ph_copyfile("C:\POWERHOME\PWRHOME.INI", "P:\PH-OFFICE"   + " " + string (month (today())) + "-" + string (day (today()))+ " " + string (hour(today())) + string (minute(today())) + ".INI", 9)',0,'','');


__________________
Pete - X10 Oldie
Back to Top View BeachBum's Profile Search for other posts by BeachBum
 
GadgetGuy
Super User
Super User
Avatar

Joined: June 01 2008
Location: United States
Online Status: Offline
Posts: 942
Posted: December 24 2012 at 14:30 | IP Logged Quote GadgetGuy

Pete -

I just came up with this simple approach, which works .
Code:
ph_backupdb("C:\powerhome\Database\dbAutoBaks\PH-
"+string(today(),"yymmdd")+".db",0)


I made this a Timed Event at 2AM each day. It writes a
new backup file with the name of the year/month/day, eg
for today Dec 24, 2012 the file would be "PH-121224.db"

Now I'm working on a way to trim the saves to be no more
than about a month's worth of backups.

Haven't discovered a PH Trim Files function yet but
already wrote a Script Server one to trim my camera
images to 10 days worth so easy to modify it to also trim
the backups.

Why are you also backing up the PH ini files?

Edited by GadgetGuy - December 24 2012 at 14:33


__________________
Ken B - Live every day like it's your last. Eventually, you'll get it right!
Back to Top View GadgetGuy's Profile Search for other posts by GadgetGuy
 
BeachBum
Super User
Super User
Avatar

Joined: April 11 2007
Location: United States
Online Status: Offline
Posts: 1880
Posted: December 24 2012 at 14:33 | IP Logged Quote BeachBum

That macro is old as it can be made much simpler. I backup the ini to be on the safe side.

__________________
Pete - X10 Oldie
Back to Top View BeachBum's Profile Search for other posts by BeachBum
 
BeachBum
Super User
Super User
Avatar

Joined: April 11 2007
Location: United States
Online Status: Offline
Posts: 1880
Posted: December 24 2012 at 14:42 | IP Logged Quote BeachBum

30 days worth should be a easy write. Maybe I'll give it a whirl. For now I manually clean them up.

__________________
Pete - X10 Oldie
Back to Top View BeachBum's Profile Search for other posts by BeachBum
 
GadgetGuy
Super User
Super User
Avatar

Joined: June 01 2008
Location: United States
Online Status: Offline
Posts: 942
Posted: December 24 2012 at 19:18 | IP Logged Quote GadgetGuy

Here is my Windows Script that trims various capture and log files . . .

Code:

'Script Name: fileTrim.vbs
'Script to Trim older Image Files out of various Directories.
'The path to webcam's Alert directory is found in the Registry.
'Subfolders in the Alert directory are then all examined and any more than 7 days older than today are deleted.

     Option Explicit
    Dim FSO, WshShell, targetFolder, folder, subFolder, Files, File, deltaDate
    Set WshShell = WScript.CreateObject("WScript.Shell")
    Set FSO=CreateObject("Scripting.FileSystemObject")
    
'Clear out webcam image files
    targetFolder= "C:\camCAPS\webcam"
    Set folder=FSO.GetFolder(targetFolder)

     For Each subFolder In folder.SubFolders
      deltaDate=DateDiff("d",subFolder.datecreated, Now)
      If deltaDate > 14 Then
           subFolder.Delete
     End If
    Next

'Now clear out Foscam image files
    targetFolder= "C:\camCAPS\Foscam"
    Set folder=FSO.GetFolder(targetFolder)
    Set Files=folder.Files

     For Each File In Files
      deltaDate=DateDiff("d",File.datecreated, Now)
      If deltaDate > 7 Then
           File.Delete
     End If
    Next

'Now clear out PH database backup files
    targetFolder= "C:\powerhome\Database\dbAutoBaks"
    Set folder=FSO.GetFolder(targetFolder)
    Set Files=folder.Files

     For Each File In Files
      deltaDate=DateDiff("d",File.datecreated, Now)
      If deltaDate > 30 Then
           File.Delete
     End If
    Next



The last section is what trims the db files to a 30 day period.


__________________
Ken B - Live every day like it's your last. Eventually, you'll get it right!
Back to Top View GadgetGuy's Profile Search for other posts by GadgetGuy
 
BeachBum
Super User
Super User
Avatar

Joined: April 11 2007
Location: United States
Online Status: Offline
Posts: 1880
Posted: December 27 2012 at 15:47 | IP Logged Quote BeachBum

Ken, took it down to 3 lines. Should replace itself each month.

Happy New Year...


insert into macroheader values ('BACKUP','BACKUP DATABASE',0,0,1);
insert into macrodetail values ('BACKUP',1,38,'',1,'PH_BACKUPDB ( "C:\PH\BACKUP\PH_SERVER.DB", 1)',0,'','');
insert into macrodetail values ('BACKUP',2,38,'',0,'ph_copyfile("C:\PH\BACKUP\PH_SERVER.DB" , "Z:\CHC-SERVER_PH\PH_SERVER DB " + string (day (today())) + ".DB", 9)',0,'','');
insert into macrodetail values ('BACKUP',3,38,'',0,'ph_copyfile("C:\POWERHOME\PWRHOME.INI", "Z:\CHC-SERVER_PH\PH_SERVER INI "   + string (day (today())) + ".INI", 9)',0,'','');


Edited by BeachBum - December 27 2012 at 15:48


__________________
Pete - X10 Oldie
Back to Top View BeachBum's Profile Search for other posts by BeachBum
 
GadgetGuy
Super User
Super User
Avatar

Joined: June 01 2008
Location: United States
Online Status: Offline
Posts: 942
Posted: December 27 2012 at 16:31 | IP Logged Quote GadgetGuy

That works.

I diddle with things so much that I wanted to back up every
day and not overwrite a file but keep adding new ones every
day. Could have used PH to delete files but it was easier
to do an Script and just run it every night.

Happy Holidays. See you soon.

__________________
Ken B - Live every day like it's your last. Eventually, you'll get it right!
Back to Top View GadgetGuy's Profile Search for other posts by GadgetGuy
 
jeffw_00
Super User
Super User


Joined: June 30 2007
Online Status: Offline
Posts: 929
Posted: December 29 2012 at 15:22 | IP Logged Quote jeffw_00

I have a 2 line macro
ph_backupdb("c:\jeff\insteon\pwrhome.db",1)
"c:\perl\bin\perl c:\jeff\insteon\phbackup.pl"

the perl script grabs a copy of pwrhome.ini, and then takes both the database backup and init file and renames them to <filename>_<num>.<ext> where num is the next unused number. This lets me keep a history as long as I like.

As far as how often - I used to do it on every startup, but now i have a control panel button and I'm good about clicking on it after every change (I don't change things that often). You could create a timed event to do it once a day or once a week, or whenever.

HTH
/j

I can publish the perl script if anyone's interested

Edited by jeffw_00 - December 29 2012 at 15:23
Back to Top View jeffw_00's Profile Search for other posts by jeffw_00
 

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