Exit LO with a terminal command such as killall?

I want to be able to use a script file to exit and save on the way to a shutdown. Can it be done?


Have you tried killall --HUP, --SIGKILL and --SIGTERM options and tested to see if they work? Some applications detect HUP signals and can be used to close apps gracefully, but not sure whether this is implemented in LO. Probably not the best way to exit out of LO because it might not always save all data.

Probably the simplest way is to save file and exit using a macro. Although primative you might have an internal LO macro read a “STATE_FILE” indicating whether you wish LibreOffice to exit or not, and have the macro checking periodically whether STATE_FILE is true or contains a certain setting. When the time is ready to exit the program just write true to STATE_FILE.

Apparently you can run python macros from the command linerun python macros from the command line (from within a python file) to programmatically control LibreOffice. Apparently python uno allows control over the user interface of LibreOffice. There is a list of uno commands which includes saving, save as, quit/exit, etc.

Some other python related material below, but I would try the options above first.

If you are game you might try using java sdk and explore the libreoffice java functions

If this answer helped you, please accept it by clicking the check mark :heavy_check_mark: to the left and, karma permitting, upvote it. That will help other people with the same question. In case you need clarification, edit your question (not an answer) or comment the relevant answer.