Pages: [1]   Go Down

Author Topic: Any scriptable 'hooks' when quitting?  (Read 1744 times)

howardm

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 1984
Any scriptable 'hooks' when quitting?
« on: December 30, 2015, 04:09:34 pm »

Hi,

I've got a moderately convoluted system of file locations and backups where my LR stuff is now written to what we would
call 'scratch space' (no backup, no RAID, but wildly fast & it is local to the machine).   What I'm looking for is an *automatic* way of, when
quitting LR (or PS really but thats a different thread), to force it to run the command of my choice (ie. an rsync from scratch to a
backed up RAID).  Even if there is LR SDK scripting involved, I'd be interested.

Pls dont suggest 'just backup the scratch space or RAIDify it'.  Could certainly do that but that is not desired right now.

Any of you LR hackers know if there are the required hooks?

Wayne Fox

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 4237
    • waynefox.com
Re: Any scriptable 'hooks' when quitting?
« Reply #1 on: December 31, 2015, 12:09:51 am »

Maybe you could develop a system level event trigger which could watch for LR quitting. Not sure if there's a way to trigger it from within LR. Maybe create a cron which can monitor the modified date as well as the status of the drive or files on the drive, and when something changes trigger a backup?

I do something similar (my main stuff is on a 512GB fast SSD), but i treat it as my main stuff, not my temporary stuff, and just keep it reliably backed up.  Auto backups down through a chain of 3 different places as well as Time Machine running.  I migrate portions of it to other storage when I'm done so the stuff on the SSD is only the files I"m working on or will be working on. Pretty easy to just drag and drop from within LR to move the stuff off to another partition.

Not a hacker, but my son in law has done several cron's to automate stuff on some of my web servers, so that's what made me think of it.
Logged

Jeremy Roussak

  • Administrator
  • Sr. Member
  • *****
  • Offline Offline
  • Posts: 8961
    • site
Re: Any scriptable 'hooks' when quitting?
« Reply #2 on: December 31, 2015, 04:58:37 am »

When running, LR creates a file called <catalogue name>.lock, which it deletes when it quits.

If you're on a Mac, you could use a folder action script (documentation here) to watch for the deletion and do whatever you like when it's noticed.

It's indirect and a bit clunky, but I think it might do the trick.

Jeremy
Logged

Jeremy Roussak

  • Administrator
  • Sr. Member
  • *****
  • Offline Offline
  • Posts: 8961
    • site
Re: Any scriptable 'hooks' when quitting?
« Reply #3 on: December 31, 2015, 05:03:27 am »

Again, Mac only: Keyboard Maestro has the ability to trigger one of its macros (which can then do almost anything) when an application quits. It's a damn fine piece of software, too.

Jeremy
Logged

john beardsworth

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 4755
    • My photography site
Re: Any scriptable 'hooks' when quitting?
« Reply #4 on: December 31, 2015, 05:05:45 am »

If you're on a Mac, you could use a folder action script....
It's indirect and a bit clunky, but I think it might do the trick.

There's certainly nothing in Lightroom itself or in the SDK that you could use.

I've got a moderately convoluted system of file locations and backups where my LR stuff is now written to what we would call 'scratch space' (no backup, no RAID, but wildly fast & it is local to the machine).   

Maybe resolve the underlying problem?
Logged

howardm

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 1984
Re: Any scriptable 'hooks' when quitting?
« Reply #5 on: December 31, 2015, 10:10:59 am »

Thanks all.

Unix for the win, once again!

Here's what I ended up with....
1. using Automator, create an app ('BU_PS' or 'BU_LR') that executes a shell script.
2. The shell script contains the magic incantation 'open -W  <path to application>'
    Normally, the open command on Mac's executes in the background and immediately return but w/ -W it 'waits' (ie. foreground)
3. When the app in question does exit, the shell script finally continues and mounts the needed volume and either does some rsync magic       or    will run an applescript via osascript command (needed to script Chronosync which I'm considering buying)

John, there isn't IMO a problem other than that my NAS was slow as molasses and since all the images are there, it's even worse when I 'Edit in Photoshop' which forces what can be multi-hundred MB .psd/.tiff over to the NAS where I can get a cup of coffee.  So after considering the options & costs and probable performance gains over single GigE, I settled on installing a spare disk I had into my machine and moved all the images over to it while keeping the RAID1 intact as backup (which is then backed to 2 different disks).

I strongly considered building my own NAS (NAS4Free/FreeNAS) but that would have been $600-900 (and for a moment considered 10gE till I saw the cost ($900 just for the 2 cards) and gotten me some performance gain but not as much as simply adding a $0 disk and some scripting.
I'm only exposed to single disk failure during the time that LR or PS is open which I can accept w/o more heroics.
Pages: [1]   Go Up