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 01-13-2011, 04:48 AM   #1
zzmijarevic
Member
zzmijarevic began at the beginning.
 
Posts: 20
Karma: 10
Join Date: Apr 2010
Device: HTC HD2
Automatic startup of calibre-server on Windows

Hi!

I have been trying to configure Windows XP to automatically start calibre-server (with options) during system startup (boot process), but with no success.

The idea is to have calibre-server working in the background. Based on suggestions in the Calibre Forum and on my own fiddling with Windows, I can point out three approaches for automatically starting calibre-server:

1) Adding a Scheduled Task (as described in forum thread 74683)
This can only work for the automatic startup of calibre-server during a logon of a user. It can only work if the user defined in the scheduled task is the same user that is logging in. The startup opens a DOS (or CMD) window with "C:\WINDOWS\system32\svchost.exe" in the window title.
Automatic startup during boot is unsuccessful regardless of user credentials.
2) Adding a Service (as proposed in thread 110212)
Unfortunately, any process based on this approach cannot be started and an error is displayed - "Error 1053: The Service did not respond to the start or control request in a timely manner" . This error has been reported in the referenced thread, but has not been tackled.
3) Adding "Run" entries in the Registry
Using "RunServices" entries in the "HKEY_LOCAL_MACHINE" hive is not successful.
"Run" entries in the "HKEY_CURRENT_USER" hive can be used to automatically start calibre-server during user logon. During the logon, an text window is opened with "C:\Program Files\Calibre2\calibre-server.exe" in the title.
Does anybody know an alternative for starting up calibre-server during system boot?

By observing the results of different approaches, I think that the problem may be that calibre-server requires an I/O terminal. Maybe that's why it launches a text window and locks the CMD window if calibre-server is invoked via the command prompt.

It would be great if I could get calibre-server to work in the background!

Thx.
zzmijarevic is offline   Reply With Quote
Old 01-13-2011, 05:16 AM   #2
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,838
Karma: 12535517
Join Date: Feb 2009
Location: North Carolina
Device: Nexus 7
Quote:
Originally Posted by zzmijarevic View Post
By observing the results of different approaches, I think that the problem may be that calibre-server requires an I/O terminal. Maybe that's why it launches a text window and locks the CMD window if calibre-server is invoked via the command prompt.
I have no experience running calibre-server but I do know that if you prefix it with the start cmd it will release the CMD window and allow it to close.

start calibre-server.exe
DoctorOhh is offline   Reply With Quote
 
Enthusiast
Old 01-13-2011, 06:47 AM   #3
zzmijarevic
Member
zzmijarevic began at the beginning.
 
Posts: 20
Karma: 10
Join Date: Apr 2010
Device: HTC HD2
"Start" is available only within the Command Interpreter ( \WINDOWS\system32\cmd.exe). The whole idea is to circumvent CMD.
zzmijarevic is offline   Reply With Quote
Old 01-13-2011, 07:06 AM   #4
Manichean
Wizard
Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!
 
Manichean's Avatar
 
Posts: 3,130
Karma: 80446
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
Try using a batch script to start up the server and invoking "start calibre-server". That should start the server and then close down the scripts' window.
Manichean is offline   Reply With Quote
Old 01-13-2011, 07:27 AM   #5
zzmijarevic
Member
zzmijarevic began at the beginning.
 
Posts: 20
Karma: 10
Join Date: Apr 2010
Device: HTC HD2
I have not been able to initiate a startup using batch scripts. Although, I'm not sure how they would work since they are not executables.
zzmijarevic is offline   Reply With Quote
Old 01-13-2011, 07:58 AM   #6
Manichean
Wizard
Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!
 
Manichean's Avatar
 
Posts: 3,130
Karma: 80446
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
Quote:
Originally Posted by zzmijarevic View Post
I have not been able to initiate a startup using batch scripts. Although, I'm not sure how they would work since they are not executables.
Batch scripts contain lists of commands as you would type them into the CLI. If you name them using the extension .bat, you should be able to start them as you would normal programs, including running them in a scheduled task.
Manichean is offline   Reply With Quote
Old 01-13-2011, 10:02 AM   #7
zzmijarevic
Member
zzmijarevic began at the beginning.
 
Posts: 20
Karma: 10
Join Date: Apr 2010
Device: HTC HD2
Let me emphasize:

I have tried 1) directly using calibre-server.exe 2) using CMD.exe with a command string 3) BATCH files (.BAT/.CMD) with START and without START commands. Scheduled tasks set for "at logon" work! However, the same tasks set for "at system startup" do not work! The Schedule tasks control panel applet indicates that the task could not start.

As I understand, there are two ways an application can launch another application or process. One way is to use the shell (explorer.exe). The other is to use an appropriate function call - something like exec(path_to_binary, array of options). I presume the second is used during system startup. I also presume that calibre-server in windows startup attempts to use text I/O but that is not available (no shell or GUI is available) and then exits.
zzmijarevic is offline   Reply With Quote
Old 01-13-2011, 12:28 PM   #8
Manichean
Wizard
Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!
 
Manichean's Avatar
 
Posts: 3,130
Karma: 80446
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
Well, I just tried starting the server via batch file. The file contained the single comand "start calibre-server --with-library=<insert_library_path_here>" and resided in the C:\ root directory. I added it as a task to be started on system boot. After I pointed the task scheduler to the .bat file, it asked me with what user credentials the task should be started, which may be the crucial point- the credentials given have to allow access to both the calibre-server.exe as well as the Calibre library directory. Your normal user ought to work fine.

I was, I have to say, for whatever reason unable to connect to the computer after it reached the logon screen (neither ping nor the calibre server, I suspect the firewall is at fault, I don't have the time now to fiddle with this further). But after I logged on, I was able to connect to the server via network, and the task manager showed the server as a running task. Personally, I'd classify that as a proof of concept and advise you to try and find out what is going wrong on your end. Posting actual error messages, if there are some, might help.
Manichean is offline   Reply With Quote
Old 01-13-2011, 01:13 PM   #9
Caltsar
Zealot
Caltsar has not lost his or her sense of wonder.Caltsar has not lost his or her sense of wonder.Caltsar has not lost his or her sense of wonder.Caltsar has not lost his or her sense of wonder.Caltsar has not lost his or her sense of wonder.Caltsar has not lost his or her sense of wonder.Caltsar has not lost his or her sense of wonder.Caltsar has not lost his or her sense of wonder.Caltsar has not lost his or her sense of wonder.Caltsar has not lost his or her sense of wonder.Caltsar has not lost his or her sense of wonder.
 
Caltsar's Avatar
 
Posts: 135
Karma: 86951
Join Date: Jan 2011
Location: Minnesota
Device: nook Touch, iPad, iPhone
It isn't ideal, but for the ZNC server I use, it opens a command window that you can't close. I found a program called hstart a while back that will hide the window and run the program "headless."

I'm not sure how to answer the rest of your question as I run calibre with a relatively stock configuration.
Caltsar is offline   Reply With Quote
Old 01-13-2011, 01:21 PM   #10
Sweetpea
Grand Sorcerer
Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.
 
Sweetpea's Avatar
 
Posts: 8,001
Karma: 22685988
Join Date: Dec 2008
Location: Krewerd
Device: HTC Flyer; BBMini; Sony PRS650; Onyx Boox T68
Quote:
Originally Posted by zzmijarevic View Post
Hi!

I have been trying to configure Windows XP to automatically start calibre-server (with options) during system startup (boot process), but with no success.

The idea is to have calibre-server working in the background. Based on suggestions in the Calibre Forum and on my own fiddling with Windows, I can point out three approaches for automatically starting calibre-server:

1) Adding a Scheduled Task (as described in forum thread 74683)
This can only work for the automatic startup of calibre-server during a logon of a user. It can only work if the user defined in the scheduled task is the same user that is logging in. The startup opens a DOS (or CMD) window with "C:\WINDOWS\system32\svchost.exe" in the window title.
Automatic startup during boot is unsuccessful regardless of user credentials.
I don't log in, yet I do have the server running with this method...

Run: "C:\Program Files\Calibre2\calibre-server.exe" --daemonize --password wachtwoord --username naam
Start in: C:\PROGRA~1\Calibre2
Run as: domainname\username (with password, naturally)

Schedule: at system startup
Sweetpea is offline   Reply With Quote
Old 01-13-2011, 03:17 PM   #11
toddos
Guru
toddos ought to be getting tired of karma fortunes by now.toddos ought to be getting tired of karma fortunes by now.toddos ought to be getting tired of karma fortunes by now.toddos ought to be getting tired of karma fortunes by now.toddos ought to be getting tired of karma fortunes by now.toddos ought to be getting tired of karma fortunes by now.toddos ought to be getting tired of karma fortunes by now.toddos ought to be getting tired of karma fortunes by now.toddos ought to be getting tired of karma fortunes by now.toddos ought to be getting tired of karma fortunes by now.toddos ought to be getting tired of karma fortunes by now.
 
toddos's Avatar
 
Posts: 694
Karma: 822675
Join Date: May 2010
Device: Kobo Aura, Nokia Lumia 920 (Freda)
I've been running calibre-server as a Windows service for quite some time now. The "sc" method doesn't work because calibre-server is not written as a service. Instead, you need to use srvany from the NT Resource Kit. http://support.microsoft.com/kb/137890. Depending on file permissions on your library location, you'll probably need to set the service identity to your username and password (do it from the UI and Windows will add the "logon as a service" right to your account if necessary).

Just make sure you shut down the service before you upgrade calibre, or you'll find yourself having to reboot after every update (because the service holds onto files that need to be updated, so those files get scheduled for update on next reboot).
toddos is offline   Reply With Quote
Old 01-18-2011, 02:14 AM   #12
zzmijarevic
Member
zzmijarevic began at the beginning.
 
Posts: 20
Karma: 10
Join Date: Apr 2010
Device: HTC HD2
Thanks Toddos!

Your solution works for me!

Additionally, I think it is a cleaner solution in respect to the Scheduled task method.
zzmijarevic is offline   Reply With Quote
Old 02-10-2011, 08:57 AM   #13
weedenbc
Junior Member
weedenbc began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Feb 2011
Device: Stanza
Does this same method for creating a service with srvany work for Windows 7? I 'd like to be able to get rid of that CMD window.
weedenbc is offline   Reply With Quote
Old 02-10-2011, 09:07 AM   #14
itimpi
Wizard
itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.
 
Posts: 4,051
Karma: 777825
Join Date: Nov 2008
Device: Sony PRS-950, iphone/ipad (Marvin/iBooks/QuickReader)
If in a batch file you use the START command to start up the server, then the batch file can terminate itself instead of hanging around.
itimpi is offline   Reply With Quote
Old 03-16-2011, 09:04 AM   #15
mathia
Member
mathia began at the beginning.
 
Posts: 12
Karma: 10
Join Date: Mar 2011
Device: Nook Color
The srvany method seems to work well, however, I was not able to get it to work. Looking back at that experience, I think I see where I went wrong. Mostly being an IT guy for a long time, I think I probably outsmarted myself. ANYWAY...having failed to get that working, I kept looking for another solution. I found that solution in a program called ServiceEx.

http://serviceex.com

It claims to be better than/different from the srvany method in that it can restart a service that has failed. I can't speak on that as I never actually got the srvany method to work. I would assume that the srvany methode gives you those options in the services console, but I don't know for sure.
The steps
1. download ServiceEx to a folder of your own choosing. There is no install, just the executable
2. download the ini file from the ServiceEx website to the same directory as the executable and modify to your needs. It doesn't have very many options and most are self explanatory. The ini file should be the name you have chosen to call your service. I, for example, chose the name cailbre-english and named my ini calibre-english.ini I am including a copy of mine at the end of this as an example. The instructions for getting it working are comments in the ini file.
3. Once you have all the options set to your liking, go to a command prompt, change to the directory where ServiceEx resides, and run the command. Mine looked like this:
serviceex.exe install calibre-english
This will set up the service with the name you chose and the options that were set in the ini file. If you didn't set the option in the file to start up the service at install, you will have to start it manually. This can be done via the command line (net start service-name) or via the services console.
One final note. The included documentation says that if you make changes to the ini file, you will have to uninstall and reinstall the service. For the more tech savvy among you, the parameters of the service can be modified directly within the registry (HKEY_Local_Machine\System\CurrentControlSet\Servi ces and look for the name of your service), then the service will need to be stopped and restarted for the changes to take effect.
To have the service restart after a failure, just go to the service console, choose the recovery tab, and set your recovery options.
If anyone decides to choose this method, I would be more than happy to assist as much as I can.
My ini file (settings only):
[ServiceEx]
ServiceExeFullPath = "C:\Program Files\calibre2\calibre-server.exe"

; program arguments to be sent to executable
options =-p 8081 --with-library "c:\calibre library"

; can program interact with desktop [true | false] (default: true)
desktop = false

; start type (valid values: Auto Manual Disabled) (default: auto)
Start=Auto

; start the service upon installation [true | false] (default: no)
StartNow=true
mathia 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
A Howto: Running Calibre Content server on Windows Startup sherman Calibre 13 03-01-2013 03:47 PM
Calibre OPDS server with windows apps? nickdma Related Tools 9 02-02-2011 03:09 PM
Issue with Calibre Server - Windows jawadams Calibre 13 01-13-2011 06:51 AM
Calibre crashes in windows on startup Jamz Calibre 12 09-17-2010 02:58 PM
Windows Startup Files - What/Why gvtexas Feedback 0 06-11-2003 10:00 AM


All times are GMT -4. The time now is 12:24 AM.


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