add run.sh CMD in Dockerfile
This commit is contained in:
23
docker/healthy_check.py
Normal file
23
docker/healthy_check.py
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import sys
|
||||
import os
|
||||
import xmlrpclib
|
||||
import json
|
||||
|
||||
api_user=os.getenv('BITMESSAGE_API_USER', 'bitmessage_api_user') ;
|
||||
api_password=os.getenv('BITMESSAGE_API_PASSWORD', 'bitmessage_api_password') ;
|
||||
api_port=os.getenv('BITMESSAGE_API_PORT', '8442') ;
|
||||
|
||||
api_link="http://{}:{}@127.0.0.1:{}/".format(api_user, api_password, api_port)
|
||||
|
||||
api = xmlrpclib.ServerProxy(api_link)
|
||||
|
||||
network_connections=json.loads(api.clientStatus())['networkConnections']
|
||||
print "networkConnections:", network_connections
|
||||
|
||||
if network_connections > 0:
|
||||
sys.exit(0)
|
||||
else:
|
||||
sys.exit(1)
|
||||
|
||||
Reference in New Issue
Block a user