Hey,
So I want to detect when bitcoind is running but that RPC server hasn't yet started up.
The way bitcoind checks whether it's already running is by using boost::file_lock
http://www.boost.org/doc/libs/1_35_0/boost/interprocess/sync/file_lock.hppAny ideas how to use this in python? I could create my own binding for python but I'd rather not have a compilable dependency for such a minor thing.
The problem with checking a systems processes is that it's unreliable to assume the program is always called bitcoin (i.e different server implementations).
I tried a different file-lock library:
$ bitcoind
$ sudo apt-get install python-lockfile
$ python
import lockfile
lock = lockfile.FileLock('.bitcoin')
with lock:
print lock.path
'.bitcoin'
$ cd .bitcoin/
$ python
import lockfile
lock = lockfile.FileLock('.lock')
with lock:
print lock.path
'.lock'
Any ideas how to do this? Must be cross-platform. File locking is an OS function, so maybe I'm not using the correct file?