For better maintenance to our Web Map Services, is there a Python Script out there to Reboot our Enterprise Server?
Thanks,
Larry Adgate`
Solved! Go to Solution.
Hi Jonathan, typically Monday morning I arrive at the office to inspect all my Web Services and they are all offline. As a remedy, I submit a request to IT to reboot the Enterprise Server and that seems to resolve the issue. I have suggested using a script to reboot the Server Early Monday morning but IT is bent on only a manual reboot.
Thanks,
Larry
Are you interested in rebooting the machine or just the ArcGIS Server Windows service? You can use the subprocess module for just about anything you can do through the command line. For example, to stop the ArcGIS Server Windows service:
import subprocess
try:
result = subprocess.check_output("net stop \"ArcGIS Server\"",stderr=subprocess.STDOUT)
print(result)
except subprocess.CalledProcessError as e:
print("Failed - {}".format(e.output))
When I need to do stuff like that, I usually use a function:
def submitCommand(command):
try:
codec = 'utf-8'
result = subprocess.check_output(command,stderr=subprocess.STDOUT)
success = True
except subprocess.CalledProcessError as e:
result = e.output
success = False
except:
result = traceback.format_exc()
success = False
if not isinstance(result,str):
result = result.decode(codec)
return success, result
I can then just call the function like:
success, result = submitCommand("net STOP \"ArcGIS Server\"")
print(success,result)
success, result = submitCommand("net START \"ArcGIS Server\"")
print(success,result)
You'll just need logic to handle the response and a failure.
Hi Jonathan, typically Monday morning I arrive at the office to inspect all my Web Services and they are all offline. As a remedy, I submit a request to IT to reboot the Enterprise Server and that seems to resolve the issue. I have suggested using a script to reboot the Server Early Monday morning but IT is bent on only a manual reboot.
Thanks,
Larry
I'd argue that the best thing to do would be to troubleshoot, (possible with Support), why your services are offline. Not sure if you've done a bit of that already. What errors or behavior do you see?