Skip to main content
Known Participant
March 22, 2019
Answered

How to trigger Catalog update main *.lrcat file?

  • March 22, 2019
  • 1 reply
  • 585 views

Hello,

Maybe someone knows how to imitate Lightroom's behavior when it closes.

I need to copy the * .lrcat file with all the changes provided, but they are saved to the * .lrcat file only after closing Lightroom.

The option “Export as catalog” does not suit me.

Thank!

This topic has been closed for replies.
Correct answer johnrellis

There's no easy way to do this. While LR is open, it puts a filesystem lock on the file, and updates may be recorded in the SQLite write-ahead log, not the .lrcat itself (as you've discovered). 

Your plugin will have to use LrTasks.execute() to run a shell script that politely asks LR to exit, waits for it to actually exit, copies the .lrcat file, then restarts LR.   The shell script should be run with "nohup" on Mac and "start /min cmd /c" on Windows, to let it keep executing after its parent process LR exits.  The script should use these idioms for asking LR to exit politely:

Mac: osascript -e 'tell application "Lightroom" to quit'

Windows: taskkill /im lightroom.exe /t

Then the script needs to keep checking for the LR process to disappear.  All very painful to get script with complete error checking and robustness.

1 reply

johnrellis
johnrellisCorrect answer
Legend
March 22, 2019

There's no easy way to do this. While LR is open, it puts a filesystem lock on the file, and updates may be recorded in the SQLite write-ahead log, not the .lrcat itself (as you've discovered). 

Your plugin will have to use LrTasks.execute() to run a shell script that politely asks LR to exit, waits for it to actually exit, copies the .lrcat file, then restarts LR.   The shell script should be run with "nohup" on Mac and "start /min cmd /c" on Windows, to let it keep executing after its parent process LR exits.  The script should use these idioms for asking LR to exit politely:

Mac: osascript -e 'tell application "Lightroom" to quit'

Windows: taskkill /im lightroom.exe /t

Then the script needs to keep checking for the LR process to disappear.  All very painful to get script with complete error checking and robustness.

Known Participant
March 28, 2019

Thank you! I'm implementing solution by your advice.