Author

Topic: Bitcoin Service Wrapper - Run Bitcoind as NT Service (Read 2416 times)

newbie
Activity: 33
Merit: 0
Anyone playing around with this, don't forget to give LocalService appropriate permissions over the Bitcoin directory.
member
Activity: 88
Merit: 10
rjk
sr. member
Activity: 448
Merit: 250
1ngldh
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!
legendary
Activity: 1260
Merit: 1000
Drunk Posts
I meant shut down as in calling bitcoind stop, rather than just killing the process. Not sure if it does anything different though.
sr. member
Activity: 322
Merit: 251
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.
legendary
Activity: 1260
Merit: 1000
Drunk Posts
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.
sr. member
Activity: 322
Merit: 251
Why not just use instsrv.exe / srvany.exe?
legendary
Activity: 1260
Merit: 1000
Drunk Posts
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.
Jump to: