aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/share/python
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-04-29 14:50:27 +0000
committerJustin Clarke Casey2008-04-29 14:50:27 +0000
commit763ae779ffb43ea9d33a9bf2a1c6c4ca78ef243d (patch)
treeade4e916a83e25d286c9e2cf95721bf5b366910e /share/python
parentCommitting Dee100's balance update patch with a few bug fixes and a twist. Th... (diff)
downloadopensim-SC-763ae779ffb43ea9d33a9bf2a1c6c4ca78ef243d.zip
opensim-SC-763ae779ffb43ea9d33a9bf2a1c6c4ca78ef243d.tar.gz
opensim-SC-763ae779ffb43ea9d33a9bf2a1c6c4ca78ef243d.tar.bz2
opensim-SC-763ae779ffb43ea9d33a9bf2a1c6c4ca78ef243d.tar.xz
From: Dr Scofield <hud@zurich.ibm.com>
* Fixes the admin_shutdown xmlrpc method * Adds a share/python/console/shutdown.py script for shutting down a background OpenSim * For more details see http://xyzzyxyzzy.net/2008/04/29/console-less-opensim/ * There should also be instructions in the opensimulator wiki soon as well
Diffstat (limited to 'share/python')
-rw-r--r--share/python/console/shutdown.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/share/python/console/shutdown.py b/share/python/console/shutdown.py
new file mode 100644
index 0000000..65f8255
--- /dev/null
+++ b/share/python/console/shutdown.py
@@ -0,0 +1,39 @@
1#!/usr/bin/python
2# -*- encoding: utf-8 -*-
3
4import ConfigParser
5import xmlrpclib
6import optparse
7import os.path
8
9if __name__ == '__main__':
10 parser = optparse.OptionParser()
11 parser.add_option('-c', '--config', dest = 'config', help = 'config file', metavar = 'CONFIG')
12 parser.add_option('-s', '--server', dest = 'server', help = 'URI for the grid server', metavar = 'SERVER')
13 parser.add_option('-p', '--password', dest = 'password', help = 'password for the grid server', metavar = 'PASSWD')
14 (options, args) = parser.parse_args()
15
16 configFile = options.config
17 if not configFile:
18 if os.path.isfile(os.path.expanduser('~/.opensim-console.rc')):
19 configFile = os.path.expanduser('~/.opensim-console.rc')
20 if not configFile:
21 parser.error('missing option config')
22 sys.exit(1)
23
24 config = ConfigParser.ConfigParser()
25 config.readfp(open(configFile))
26
27 server = config.get('opensim', 'server')
28 password = config.get('opensim', 'password')
29
30 if options.server: server = options.server
31 if options.password: password = options.password
32
33 gridServer = xmlrpclib.Server(server)
34 res = gridServer.admin_shutdown({'password': password})
35
36 if res['success'] == 'true':
37 print 'shutdown of %s initiated' % server
38 else:
39 print 'shutdown of %s failed' % server