You should use the full absolute path to the calibre binary. And pass it the arguments
--detach and --with-library /absolute/path/to/library/folder
And make sure it is running as the same user as owns the files in the library folder.
For complete robustness you should also set the environmnet variables that tell calibre where its config, cache and temp dirs are, see
https://manual.calibre-ebook.com/cus...ment-variables