#!/usr/bin/python import os import subprocess import requests BOOTSTRAP_SERVER_ADDRESS = '10.10.10.10:5555' def retrieve_config(): my_config = "None" my_ip = subprocess.check_output("sleep 5 && echo $MY_IP", shell=True).rstrip() resp = requests.get("http://%s/getmyconfig/%s"%(BOOTSTRAP_SERVER_ADDRESS, my_ip)) my_config = resp.text if my_config != "None": subprocess.check_output("node /mydir/*.js %s"%(my_config), shell=True) #print("my_ip=%s and of type %s"%(my_ip,type(my_ip))) retrieve_config()