Auto-Save

Posted on
Sun Mar 31, 2024 11:27 am
makedrinklas offline
Posts: 124
Joined: Oct 12, 2004

Auto-Save

Hi!
It would be useful to have an automatic backup system in place for the database with save iterations to a specific different location, such as iCloud or an external drive.

This might be helpful for people who frequently tweak their setups.

I do this manually, but it could be good to have them auto-created at intervals, daily, every 15 minutes while working, etc.

Maybe at some point be able to preview the database and pick out the command(s) you'd like to restore. Sort of like the Save As function maybe even to export individual commands/devices to import back into the newer database. Like a fakey undo work-around.

Lastly, since folders allow drag and drop, it could also be useful to use folders in devices, triggers, actions and run commands on the entire contents. (Enable all, etc.)

Posted on
Sun Mar 31, 2024 12:22 pm
ryanbuckner offline
Posts: 1081
Joined: Oct 08, 2011
Location: Northern Virginia

Re: Auto-Save

FWIW - I have been using this script to backup Indigo once a month on a schedule. It obv doesn't do the other things on your wish list, but it's a start

Code: Select all
import distutils
import distutils.archive_util
import zipfile
import time

path = "/Users/ryanbuckner/Documents/Indigo Backups"  #Change this to your desired path
number_of_days = 10  #Change this to the number of days you want to keep backups

def remove(path):
    if os.path.isdir(path):
        try:
            indigo.server.log(" - removing folder %s" % path)
            os.rmdir(path)
        except OSError:
            indigo.server.log( " - unable to remove folder: %s" % path)
    else:
        try:
            if os.path.exists(path):
                indigo.server.log(" - removing file %s" % path)
                os.remove(path)
        except OSError:
            indigo.server.log( " - unable to remove file: %s" % path)

indigo.server.log ("Starting backup; saving to %s" % path )
time_in_secs = time.time() - (number_of_days * 24 * 60 * 60)
for root, dirs, files in os.walk(path, topdown=False):
    for file_ in files:
        full_path = os.path.join(root, file_)
        stat = os.stat(full_path)
        if stat.st_mtime <= time_in_secs:
            remove(full_path)
    if not os.listdir(root):
        remove(root)

archive_filename_template  = "Indigo_Backup_%m_%d_%Y__%H_%M_%S"
archive_filename =  os.path.expanduser ( path + os.sep + time.strftime ( archive_filename_template, time.localtime() ) )
indigo.server.log (" - archive filename %s" % archive_filename + ".zip")
indigo.server.log (" - save path %s" % indigo.server.getInstallFolderPath() )

try:
    distutils.archive_util.make_zipfile ( archive_filename, os.path.expanduser ( indigo.server.getInstallFolderPath()) )
except zipfile.LargeZipFile:
    indigo.server.log ("Zip file too big.  Would require 64 bit extensions")
   
indigo.server.log ("Backup Finished.")

Posted on
Sun Mar 31, 2024 12:36 pm
makedrinklas offline
Posts: 124
Joined: Oct 12, 2004

Re: Auto-Save

That is awesome, thanks!

Posted on
Thu Apr 04, 2024 1:28 pm
jay (support) offline
Site Admin
User avatar
Posts: 18229
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Auto-Save

Indigo does auto-saves. If you have Time Machine configured to back up the Indigo installation folder, then you automatically have checkpointed database backups via Time Machine. To revert, shut down the Indigo Server, open the databases folder in the install directory in the Finder, then use the Time Machine interface to restore an older version of the database file. Restart the server and you've successfully reverted to a prior version.

This is also the best way to back up your complete Indigo install.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest