Tuesday, February 18, 2014

libreoffice - terminate called after throwing an instance of 'com::sun::star::uno::RuntimeException'

The below works from command line:
$ libreoffice --headless --help
However from a nodejs server it was not working but instead failing with:
terminate called after throwing an instance of 'com::sun::star::uno::RuntimeException'
Every time a command does not work from an environment but it works from the command line you need to look at the environment. So in running the 'env' command and comparing the results from such environment and command line we should be able to determine what is different and what needs to be changed.

In this case we were caught by a HOME variable forced to an invalid path. However in reviewing the upstart script I realized we could be doing so much better. Upstart scripts should use no sudo nor using su but instead start-stop-daemo:
$ vi /etc/init/shell-server.conf
    #export HOME="/root"
    #exec sudo -u admin /usr/local/bin/node /opt/nodejs/shell-server.js
    #exec su -c "/usr/local/bin/node /opt/nodejs/shell-server.js" dev
    exec start-stop-daemon --start -c dev --exec /usr/local/bin/node /opt/nodejs/shell-server.js
end script

No comments: