Bitcoin Forum

Bitcoin => Project Development => Topic started by: mb300sd on September 11, 2011, 06:23:30 PM



Title: Bitcoin Service Wrapper - Run Bitcoind as NT Service
Post by: mb300sd on September 11, 2011, 06:23:30 PM
I wrote a simple wrapper program that runs bitcoind as a NT service so that you don't have to be logged on for it to be running. Useful for any web server that needs to access it, and allows it to be auto started.

Put BitcoinServiceWrapper.exe somewhere that your Local Service account has access to it. Put your bitcoin.conf in C:\Windows\ServiceProfiles\LocalService\AppData\Roaming\Bitcoin. Run BitcoinServiceWrapper.exe install and then sc start bitcoind to install the service and start it.

http://www.mediafire.com/?cyy1lqp6xo9042h

Donations welcome if you find it useful, 5BTC required if you use it commercially.


Title: Re: Bitcoin Service Wrapper - Run Bitcoind as NT Service
Post by: nhodges on September 11, 2011, 10:06:12 PM
Why not just use instsrv.exe / srvany.exe?


Title: Re: Bitcoin Service Wrapper - Run Bitcoind as NT Service
Post by: mb300sd on September 11, 2011, 10:20:20 PM
I have code in OnStop() that shuts down bitcoind, and just find this to be a cleaner approach. Using this for myself and may add other bitcoin specific features if needed.


Title: Re: Bitcoin Service Wrapper - Run Bitcoind as NT Service
Post by: nhodges on September 11, 2011, 11:09:37 PM
I thought that's the sort of functionality the combination of those two executables provide: the ability to start/stop any .exe via Windows Service controls.


Title: Re: Bitcoin Service Wrapper - Run Bitcoind as NT Service
Post by: mb300sd on September 12, 2011, 12:06:50 AM
I meant shut down as in calling bitcoind stop, rather than just killing the process. Not sure if it does anything different though.


Title: Re: Bitcoin Service Wrapper - Run Bitcoind as NT Service
Post by: rjk on February 16, 2012, 11:19:22 PM
Here are some mods I made so that this could work with other coins. At the moment, it is set up for Bitcoin, Namecoin, and Litecoin. Using the included file structure, it is pretty simple to modify for other altchains, just copy one folder and then find/replace all references from Bitcoin to whatever else you want to run.

Why use this instead of instsrv/srvany? As mentioned in the previous post, srvany terminates bitcoind uncleanly, which isn't very nice. Unfortunately, bitcoind (and any variants based on it) don't seem to understand standard shutdown signals - and instead force you to send it the command "stop". That's what these service wrappers do: when you click Stop (or do "net stop bitcoind"), it sends bitcoind the command "stop", and then waits for it to exit before quitting.

Unfortunately I don't have the necessary code chops to make this work with P2Pool - it requires modifications so that you can pass arguments - however, P2Pool is OK to kill and not try any graceful termination (according to forrestv, its author). So Instsrv/Srvany work just fine with it.

The binaries have been pre-compiled for you, but I always encourage everyone to compile it themselves to be sure. It really is only 2 or 3 clicks to compile once VS 2010 is installed - instructions are in the README.txt in the archive.

http://www.mediafire.com/file/qenfz6ctvez2lkv/ServiceWrappers.7z

Code:
  File: ServiceWrappers.7z
CRC-32: 62a30307
   MD4: 11d89c5fd6895a7e1f0d706deb62ec97
   MD5: 90022cf69c804a34de99b63cd3bb80fd
 SHA-1: f0e04800699e4ccf94e4c491796ad5941d3fc292

Enjoy!


Title: Re: Bitcoin Service Wrapper - Run Bitcoind as NT Service
Post by: MasterX on November 14, 2012, 08:59:08 AM
http://www.mediafire.com/file/qenfz6ctvez2lkv/ServiceWrappers.7z
Is there a mirror for this file?
The link above seems broken.


Title: Re: Bitcoin Service Wrapper - Run Bitcoind as NT Service
Post by: Kiaya on August 02, 2013, 10:56:24 AM
Anyone playing around with this, don't forget to give LocalService appropriate permissions over the Bitcoin directory.