Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 05-29-2010, 10:17 PM   #1
gkbeer
Enthusiast
gkbeer began at the beginning.
 
Posts: 27
Karma: 30
Join Date: Mar 2006
Device: Kindle, iPod Touch,
[Old Thread] Daemonizing the calibre-server in Ubuntu

I've created /etc/init.d/calibre (attahced)

It seems to work but no /var/run/calibre.pid file is being generated.

So the command to start the content server "/etc/init.d/calibre start" hangs. Even though the script hangs, the server does start.

Killing the terminal doesn't kill the server, and "/etc/init.d/calibre stop" fails to stop the server as well.

Is creating the .pid file the responsibility of calibre-server or the init script?

Or do I need to rewrite the script to do starts and stops without a .pid file?

--Glenn

Last edited by gkbeer; 06-04-2010 at 10:04 PM. Reason: removed obsolete file, see later post for current copy.
gkbeer is offline   Reply With Quote
Old 05-29-2010, 10:23 PM   #2
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,843
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
you need to use the --pidfile argument to calibre-server
kovidgoyal is online now   Reply With Quote
Advert
Old 05-30-2010, 02:37 AM   #3
gkbeer
Enthusiast
gkbeer began at the beginning.
 
Posts: 27
Karma: 30
Join Date: Mar 2006
Device: Kindle, iPod Touch,
OK, --pidfile was what I needed.

I also found that the order in which the options were listed was important too.

--with-library=MYLIBRARY --pidfile=/var/run/calibre-server.pid --daemonize

Starting the daemon works but the process started is not calibre-server but /opt/calibre/loader.

Is that right? It seems to work when I load http://localhost:8080.

"/etc/init.d/calibre stop" isn't working now.
The line "start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME" is messed up because the command to start the content server is calibre-server while the actual process left running is /opt/calibre/loader.

Changing that line to read "loader" in place of $NAME, seems to work.


The attached file is my copy of /etc/init.d/calibre for Ubuntu 9.10. Not pretty but it works.

Last edited by gkbeer; 06-04-2010 at 10:03 PM. Reason: removed obsolete file, see later post for current copy.
gkbeer is offline   Reply With Quote
Old 05-30-2010, 03:12 AM   #4
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,843
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You dont need to use --name uf you're using --pidfile when calling start-stop-daemon
kovidgoyal is online now   Reply With Quote
Old 06-04-2010, 09:49 PM   #5
gkbeer
Enthusiast
gkbeer began at the beginning.
 
Posts: 27
Karma: 30
Join Date: Mar 2006
Device: Kindle, iPod Touch,
That did it.

/etc/init.d/skeleton in Ubuntu 9.04 had more options in it that I needed.

Here is my final copy for others to reference.
You will need to edit it to change...
CONTENT=/home/glenn/Library to point to your library.

It goes in /etc/init.d and should be named calibre without the .txt.
In a terminal the following commands need to be run:

cd /etc/init.d
sudo chown root calibre
sudo chgrp root calibre
sudo chmod 755 calibre
sudo insserv calibre


Start/stop the calibre content server with:

sudo /etc/init.d/calibre start
sudo /etc/init.d/calibre stop


Note: don't forget to turn off starting the content server in Calibre's preferences.
Attached Files
File Type: txt calibre.txt (3.5 KB, 2572 views)

Last edited by gkbeer; 06-04-2010 at 09:55 PM. Reason: added note about CONTENT
gkbeer is offline   Reply With Quote
Advert
Old 07-12-2010, 03:03 PM   #6
astrodad
Guru
astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.astrodad ought to be getting tired of karma fortunes by now.
 
astrodad's Avatar
 
Posts: 962
Karma: 568242
Join Date: Dec 2007
Device: Kindle Oasis 3, Kindle Paperwhite 1, iPad, iPhone
Thanks for posting this. I modified mine to include the port, username, password, and the --develop flag to updates to the library trigger a restart.

Thanks!
astrodad is offline   Reply With Quote
Old 01-18-2013, 11:52 AM   #7
docthomas
Junior Member
docthomas began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Jan 2013
Device: kindle
Quote:
Originally Posted by gkbeer View Post
That did it.

/etc/init.d/skeleton in Ubuntu 9.04 had more options in it that I needed.

Here is my final copy for others to reference.
You will need to edit it to change...
CONTENT=/home/glenn/Library to point to your library.

It goes in /etc/init.d and should be named calibre without the .txt.
In a terminal the following commands need to be run:

cd /etc/init.d
sudo chown root calibre
sudo chgrp root calibre
sudo chmod 755 calibre
sudo insserv calibre


Start/stop the calibre content server with:

sudo /etc/init.d/calibre start
sudo /etc/init.d/calibre stop


Note: don't forget to turn off starting the content server in Calibre's preferences.

I am having trouble using this method with an unbuntu 12.04 server. When I issue the sudo insserv calibre command I get:
sudo: inserv: command not found

I have searched but I cant seen to find an answer on why this fails. I am using the script that was attached to the thread.

Thanks for any help you can provide.
docthomas is offline   Reply With Quote
Old 01-18-2013, 05:19 PM   #8
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 9,864
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Nexus 7
Quote:
Originally Posted by docthomas View Post
I have searched but I cant seen to find an answer on why this fails. I am using the script that was attached to the thread.
The info is 2.5 years old so things may have changed between 9.04 and 12.04. Hopefully someone with knowledge will step up with some help.

Good Luck.
DoctorOhh is offline   Reply With Quote
Old 01-19-2013, 08:38 AM   #9
latepaul
Wizard
latepaul ought to be getting tired of karma fortunes by now.latepaul ought to be getting tired of karma fortunes by now.latepaul ought to be getting tired of karma fortunes by now.latepaul ought to be getting tired of karma fortunes by now.latepaul ought to be getting tired of karma fortunes by now.latepaul ought to be getting tired of karma fortunes by now.latepaul ought to be getting tired of karma fortunes by now.latepaul ought to be getting tired of karma fortunes by now.latepaul ought to be getting tired of karma fortunes by now.latepaul ought to be getting tired of karma fortunes by now.latepaul ought to be getting tired of karma fortunes by now.
 
latepaul's Avatar
 
Posts: 1,264
Karma: 10203040
Join Date: Dec 2011
Device: a variety (mostly kindles and kobos)
For some reason insserv is no longer on the path in 12.04. Anyway in Glenn's instructions replace the line:

Quote:
sudo insserv calibre
with

Quote:
sudo /usr/lib/insserv/insserv calibre
If you google it various places will tell you to make a sym link so that it's on your path e.g. here but that's up to you.

Attached is an updated "calibre" file based on the 12.04 /etc/init.d/skeleton.

Disclaimer: I tested this on Linux Mint 14 rather than Ubuntu 12.04 itself though I don't believe there are any differences in this regard.
Attached Files
File Type: txt calibre.txt (4.3 KB, 424 views)
latepaul is offline   Reply With Quote
Old 01-20-2013, 12:10 PM   #10
docthomas
Junior Member
docthomas began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Jan 2013
Device: kindle
Quote:
Originally Posted by latepaul View Post
For some reason insserv is no longer on the path in 12.04. Anyway in Glenn's instructions replace the line:



with



If you google it various places will tell you to make a sym link so that it's on your path e.g. here but that's up to you.

Attached is an updated "calibre" file based on the 12.04 /etc/init.d/skeleton.

Disclaimer: I tested this on Linux Mint 14 rather than Ubuntu 12.04 itself though I don't believe there are any differences in this regard.
Thanks that got my passed the insserv problem but for some reason calibre-server will not run with the --daemonize option. Even from the command line if I pass that option calibre starts and than exits. If I remove --daemonize option the server will launch.
docthomas is offline   Reply With Quote
Old 01-20-2013, 12:24 PM   #11
docthomas
Junior Member
docthomas began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Jan 2013
Device: kindle
Quote:
Originally Posted by docthomas View Post
Thanks that got my passed the insserv problem but for some reason calibre-server will not run with the --daemonize option. Even from the command line if I pass that option calibre starts and than exits. If I remove --daemonize option the server will launch.
Nevermind. I didnt have root listed for the RUN_AS user. Cmdline launching of calibre-server with --daemonize required sudo also. NOOB..
Thanks for the help.
docthomas is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Ubuntu Calibre server acting wonky weidbrewer Library Management 18 08-02-2011 12:07 AM
Calibre-Server - Ubuntu 10.10 - Running but not serving dcmarquardt Calibre 10 04-05-2011 07:33 PM
Calibre on ubuntu server tdw197 Calibre 24 01-19-2011 07:48 AM
Calibre crashes X server (Ubuntu 10.10) mfabry Calibre 9 10-15-2010 04:12 PM
Calibre RuntimeError on Ubuntu 8.04 Server alexbt Calibre 3 10-13-2009 04:26 AM


All times are GMT -4. The time now is 06:59 PM.


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