Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 05-29-2010, 11: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 11:04 PM. Reason: removed obsolete file, see later post for current copy.
gkbeer is offline   Reply With Quote
Old 05-29-2010, 11: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: 26,338
Karma: 5382313
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
you need to use the --pidfile argument to calibre-server
kovidgoyal is offline   Reply With Quote
Old 05-30-2010, 03: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 11:03 PM. Reason: removed obsolete file, see later post for current copy.
gkbeer is offline   Reply With Quote
Old 05-30-2010, 04: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: 26,338
Karma: 5382313
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 offline   Reply With Quote
Old 06-04-2010, 10: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, 1312 views)

Last edited by gkbeer; 06-04-2010 at 10:55 PM. Reason: added note about CONTENT
gkbeer is offline   Reply With Quote
Old 07-12-2010, 04: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: 945
Karma: 568242
Join Date: Dec 2007
Device: Kindle Paperwhite 1, iPad, iPhone 5
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, 12:52 PM   #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, 06: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: 8,888
Karma: 12755553
Join Date: Feb 2009
Location: North Carolina
Device: 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, 09:38 AM   #9
latepaul
Fanatic
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: 550
Karma: 3534622
Join Date: Dec 2011
Device: Kobo Touch, Kindle Touch, Kobo Mini, Kobo Aura HD, Nexus 7, Kindle PW2
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, 169 views)
latepaul is offline   Reply With Quote
Old 01-20-2013, 01: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, 01: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

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

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


All times are GMT -4. The time now is 10:32 AM.


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