Console-less OpenSim

From OpenSimulator

Revision as of 07:05, 29 April 2008 by DrScofield (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Console-less OpenSim

normally opensim will only run in console mode: whenever you start OpenSim you will end up at a prompt inside OpenSim's very own console — which is very convenient if you want to manage it that way. it is rather inconvenient if you want to start OpenSim as a daemon in the background (e.g., from /etc/init.d/opensim) and control it via the RemoteAdminPlugin, for example.

as of OpenSim's subversion release r4400 the basic support for running OpenSim without such a console is in the code base and all you need to do is invoke OpenSim with the -background True commandline parameter:

   % mono --debug OpenSim.exe -background True

note: that is just a single dash for the -background option!

to shutdown a console-less OpenSim instance, use the following script (also located in share/python/console):

# -*- encoding: utf-8 -*-

import ConfigParser
import xmlrpclib
import optparse
import os.path

if __name__ == '__main__':
    parser = optparse.OptionParser()
    parser.add_option('-c', '--config', dest = 'config', help = 'config file', metavar = 'CONFIG')
    parser.add_option('-s', '--server', dest = 'server', help = 'URI for the grid server', metavar = 'SERVER')
    parser.add_option('-p', '--password', dest = 'password', help = 'password for the grid server', metavar = 'PASSWD')
    (options, args) = parser.parse_args()

    configFile = options.config
    if not configFile:
        if os.path.isfile(os.path.expanduser('~/.opensim-console.rc')):
            configFile = os.path.expanduser('~/.opensim-console.rc')
    if not configFile:
        parser.error('missing option config')

    config = ConfigParser.ConfigParser()

    server = config.get('opensim', 'server')
    password = config.get('opensim', 'password')
    if options.server: server = options.server
    if options.password: password = options.password

    gridServer = xmlrpclib.Server(server)
    res = gridServer.admin_shutdown({'password': password})

    if res['success'] == 'true':
        print 'shutdown of %s initiated' % server
        print 'shutdown of %s failed' % server

you can either pass in the server URI and password to use via commandline parameters, or you can create .opensim-console.rc in your home directory and set default values:

server =
password = secret

then all you need to do to shutdown your OpenSim server is invoke

the goal is to extend into a remote console of sorts.

(adapted from xyzzy xyzzy)'

Personal tools
About This Wiki