Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Related Tools

Notices

Reply
 
Thread Tools Search this Thread
Old 05-31-2014, 02:45 PM   #1
paul55391
Enthusiast
paul55391 began at the beginning.
 
Posts: 43
Karma: 10
Join Date: Aug 2013
Device: iPad
Problem starting calibre-server automatically at system startup (Mac)

My calibre library is on an external drive connected to my Mac mini server. I've created a plist file (for starting calibre-server) in /Library/LaunchDaemons. When I restart the server I'm expecting launchd to read the plist file and start calibre-server; however, for some reason I need to manually start calibre-server using "launchctl load calibre-server.plist" in Terminal. I'm suspecting that the external drive is not mounted when launchd processes the plist file and so the calibre-server startup fails. I'd like to hear from anyone who might be able to suggest a solution to this problem.
paul55391 is offline   Reply With Quote
Old 06-01-2014, 01:57 AM   #2
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Try mounting the drive as part of the startup job, to make sure it is accessible.

Or try starting a test library on the main drive to see if that's the problem.
eschwartz is offline   Reply With Quote
Advert
Old 06-01-2014, 02:25 PM   #3
paul55391
Enthusiast
paul55391 began at the beginning.
 
Posts: 43
Karma: 10
Join Date: Aug 2013
Device: iPad
I tried starting a test library on my main drive and launchd didn't start the caliber server, so the problem is probably not with the mounting of the external drive. Manually starting the calibre server with the test library works.

I'm assuming that launchd looks at all the plist files in /Library/LaunchDaemons, and that I need do nothing more that put a plist file in that directory in order for it to be processed by launchd on system startup.

So... I'm still having a problem with this.
paul55391 is offline   Reply With Quote
Old 06-01-2014, 02:50 PM   #4
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Quote:
Originally Posted by paul55391 View Post
I tried starting a test library on my main drive and launchd didn't start the caliber server, so the problem is probably not with the mounting of the external drive. Manually starting the calibre server with the test library works.

I'm assuming that launchd looks at all the plist files in /Library/LaunchDaemons, and that I need do nothing more that put a plist file in that directory in order for it to be processed by launchd on system startup.

So... I'm still having a problem with this.
I know nothing about OSX, so I can't help you any further, but I did find this on Google:

https://developer.apple.com/library/...72i-SW7-108425

Quote:
The launchd Startup Process
After the system is booted and the kernel is running, launchd is run to finish the system initialization. As part of that initialization, it goes through the following steps:
  1. It loads the parameters for each launch-on-demand system-level daemon from the property list files found in /System/Library/LaunchDaemons/ and /Library/LaunchDaemons/.
  2. It registers the sockets and file descriptors requested by those daemons.
  3. It launches any daemons that requested to be running all the time.
  4. As requests for a particular service arrive, it launches the corresponding daemon and passes the request to it.
  5. When the system shuts down, it sends a SIGTERM signal to all of the daemons that it started.
So your assumption appears to be correct.
eschwartz is offline   Reply With Quote
Old 06-01-2014, 03:14 PM   #5
paul55391
Enthusiast
paul55391 began at the beginning.
 
Posts: 43
Karma: 10
Join Date: Aug 2013
Device: iPad
Thanks. Perhaps someone with Mac or Linux experience can offer some help.

I do notice a --daemonize parameter for calibre-server, and I haven't used that since I was assuming that Mac OS "daemonizes" calibre-server since that's its primary function. That brings into question the purpose of this parameter though.
paul55391 is offline   Reply With Quote
Advert
Old 06-01-2014, 11:08 PM   #6
ssholloway
Connoisseur
ssholloway has a complete set of Star Wars action figures.ssholloway has a complete set of Star Wars action figures.ssholloway has a complete set of Star Wars action figures.
 
ssholloway's Avatar
 
Posts: 99
Karma: 280
Join Date: Nov 2010
Device: iPhone6, iPadMiniRetina, KindlePW3, KoboGloHD
paul55391: I replied to your message in the launchd thread saying the plist didn't work before I saw in this thread that you're also having problems. I was interested in using launchd since I wanted the calibre server to start on demand and then stop after a certain period of idle time, instead of always running as it does now. Maybe someone with more knowledge of launchd can help us out on either thread.

Currently I start the calibre server through a shell script I wrote in automator and saved as an application, which I then added to my login items. I've attached a screenshot of the shell script in automator if you want to try this.

--daemonize causes the calibre server to run as a background process under OSX so it accomplishes the same thing as KeepAlive=true in the plist and should do what you are asking for. You will need to mount any external drive containing the calibre DB before the shell script runs. Which is why I keep my DB on the conent server's hard drive.
Attached Thumbnails
Click image for larger version

Name:	calibre-server automator.jpg
Views:	697
Size:	232.8 KB
ID:	123588  
ssholloway is offline   Reply With Quote
Old 06-02-2014, 09:14 PM   #7
paul55391
Enthusiast
paul55391 began at the beginning.
 
Posts: 43
Karma: 10
Join Date: Aug 2013
Device: iPad
I'm trying to start up the calibre content server to make my library available in the internet. I don't want to require that I'm logged into an account on the server. I just want to start the calibre content server as a daemon when the system is booted. I understand what you did though.
paul55391 is offline   Reply With Quote
Old 06-05-2014, 04:51 PM   #8
paul55391
Enthusiast
paul55391 began at the beginning.
 
Posts: 43
Karma: 10
Join Date: Aug 2013
Device: iPad
I've figured out how to start up 2 calibre content servers for 2 libraries that are on my Mac mini server. I created 2 plist files and placed them in /Library/LaunchDaemons/. The ownership for the files needs to be set to root:wheel using 2 commands:
sudo chown root:wheel local.calibre_server_8080.plist
sudo chown root:wheel local.calibre_server_8081.plist
One plist file contains:
Quote:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>local.calibre_server_8080</string>
<key>ProgramArguments</key>
<array>
<string>/Applications/calibre.app/Contents/MacOS/calibre-server</string>
<string>--port=8080</string>
<string>--timeout=10</string>
<string>--username=calibre</string>
<string>--password=egbdfa!</string>
<string>--with-library=/Volumes/WD3TB/Calibre Library</string>
</array>
</dict>
</plist>
and the other plist file contains:

Quote:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>local.calibre_server_8081</string>
<key>ProgramArguments</key>
<array>
<string>/Applications/calibre.app/Contents/MacOS/calibre-server</string>
<string>--port=8081</string>
<string>--timeout=10</string>
<string>--username=calibre</string>
<string>--password=egbdfa!</string>
<string>--with-library=/Volumes/WD3TB/Calibre Library (Larisa)</string>
</array>
</dict>
</plist>
Rebooting the server and I can access my two libraries anywhere in the world! (Sorry, I didn't indent the plist files but I don't know how to do that on this forum and the leading tabs and spaces got stripped out.)

Last edited by paul55391; 06-05-2014 at 10:01 PM. Reason: adjust password
paul55391 is offline   Reply With Quote
Old 06-05-2014, 08:45 PM   #9
ssholloway
Connoisseur
ssholloway has a complete set of Star Wars action figures.ssholloway has a complete set of Star Wars action figures.ssholloway has a complete set of Star Wars action figures.
 
ssholloway's Avatar
 
Posts: 99
Karma: 280
Join Date: Nov 2010
Device: iPhone6, iPadMiniRetina, KindlePW3, KoboGloHD
Nice! I'll definitely give this a try this weekend.
ssholloway is offline   Reply With Quote
Old 06-05-2014, 10:00 PM   #10
paul55391
Enthusiast
paul55391 began at the beginning.
 
Posts: 43
Karma: 10
Join Date: Aug 2013
Device: iPad
Sorry, but although I thought it was working, I now discover that the calibre content server hangs after a while. I have been testing it using my iPad and my MacBook Pro. So, there's either a problem with the content server or I need to do more to get it working reliably.

If anyone have some suggestions, please chime in.
paul55391 is offline   Reply With Quote
Old 06-06-2014, 12:24 AM   #11
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Instead of using "[QUOTE]the quote[/QUOTE]" tags, use "[CODE]the code[/CODE]" to get proper tabbing.
eschwartz is offline   Reply With Quote
Old 06-06-2014, 07:11 PM   #12
ssholloway
Connoisseur
ssholloway has a complete set of Star Wars action figures.ssholloway has a complete set of Star Wars action figures.ssholloway has a complete set of Star Wars action figures.
 
ssholloway's Avatar
 
Posts: 99
Karma: 280
Join Date: Nov 2010
Device: iPhone6, iPadMiniRetina, KindlePW3, KoboGloHD
Quote:
Originally Posted by paul55391 View Post
Sorry, but although I thought it was working, I now discover that the calibre content server hangs after a while. I have been testing it using my iPad and my MacBook Pro. So, there's either a problem with the content server or I need to do more to get it working reliably.

If anyone have some suggestions, please chime in.
Just guessing at this point but try removing the timeout string and let the value default to 120. I'll experiment with your plist this weekend.
ssholloway is offline   Reply With Quote
Old 06-07-2014, 10:48 AM   #13
paul55391
Enthusiast
paul55391 began at the beginning.
 
Posts: 43
Karma: 10
Join Date: Aug 2013
Device: iPad
I removed the timeout line. Because I have a fairly large number of books, you may be right that I set the timeout too low. Thanks.
paul55391 is offline   Reply With Quote
Old 04-02-2015, 11:52 PM   #14
paul55391
Enthusiast
paul55391 began at the beginning.
 
Posts: 43
Karma: 10
Join Date: Aug 2013
Device: iPad
Trying to run calibre content server as daemon on Mac

I reinstalled my Mac home server and have discovered that the calibre-server can no longer be started as a daemon using the plist files I posted on this thread. Monitoring the system log file I see a bunch of messages that indicate attempts to write to a display, and I don't think this should be happening.

Anyone out there who can offer some help on this?
paul55391 is offline   Reply With Quote
Old 04-02-2015, 11:56 PM   #15
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Change the path of the server to

/Applications/calibre.app/Contents/console.app/Contents/MacOS/calibre-server

And what error messages are you seeing in the log?
kovidgoyal is offline   Reply With Quote
Reply

Tags
calibre-server, launchd, mac os


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
A Howto: Running Calibre Content server on Windows Startup sherman Calibre 26 02-17-2019 10:37 PM
Calibre server not starting john_es Library Management 0 02-02-2013 06:16 AM
Startup Calibre-server on windows 7 x64 profesional roadrunnerm Calibre 0 10-19-2012 04:18 AM
Automatic startup of calibre-server on Windows zzmijarevic Calibre 17 04-02-2012 04:26 AM
Latest version of calibre crashes on startup on Mac alvareo Devices 4 12-23-2011 12:34 AM


All times are GMT -4. The time now is 05:23 AM.


MobileRead.com is a privately owned, operated and funded community.