48
49
elif os.path.exists(_oldxml2):
49
50
sys.path.insert(0,_oldxml2)
53
53
__author__ = release.author
54
54
__version__ = release.version
56
# We DON't log this using the standard logger, because we might mess
57
# with the logfile's permissions. Just do a quick exit here.
58
if pwd.getpwuid(os.getuid())[0] == 'root' :
59
sys.stderr.write("Attempted to run OpenERP server as root. This is not good, aborting.\n")
56
62
#----------------------------------------------------------
58
64
#----------------------------------------------------------
105
111
# Load and update databases if requested
106
112
#----------------------------------------------------------
114
import service.http_server
116
if not ( tools.config["stop_after_init"] or \
117
tools.config["translate_in"] or \
118
tools.config["translate_out"] ):
119
service.http_server.init_servers()
120
service.http_server.init_xmlrpc()
122
import service.netrpc_server
123
service.netrpc_server.init_servers()
108
125
if tools.config['db_name']:
109
126
for db in tools.config['db_name'].split(','):
110
127
pooler.get_db_and_pool(db, update_module=tools.config['init'] or tools.config['update'])
147
164
#----------------------------------------------------------
149
166
#----------------------------------------------------------
151
if tools.config['xmlrpc']:
152
port = int(tools.config['port'])
153
interface = tools.config["interface"]
154
secure = tools.config["secure"]
156
httpd = netsvc.HttpDaemon(interface, port, secure)
158
xml_gw = netsvc.xmlrpc.RpcGateway('web-services')
159
httpd.attach("/xmlrpc", xml_gw)
160
logger.notifyChannel("web-services", netsvc.LOG_INFO,
161
"starting XML-RPC%s services, port %s" %
162
((tools.config['secure'] and ' Secure' or ''), port))
165
#if tools.config["soap"]:
166
# soap_gw = netsvc.xmlrpc.RpcGateway('web-services')
167
# httpd.attach("/soap", soap_gw )
168
# logger.notifyChannel("web-services", netsvc.LOG_INFO, 'starting SOAP services, port '+str(port))
171
if tools.config['netrpc']:
172
netport = int(tools.config['netport'])
173
netinterface = tools.config["netinterface"]
174
tinySocket = netsvc.TinySocketServerThread(netinterface, netport, False)
175
logger.notifyChannel("web-services", netsvc.LOG_INFO,
176
"starting NET-RPC service, port %d" % (netport,))
178
168
LST_SIGNALS = ['SIGINT', 'SIGTERM']
179
169
if os.name == 'posix':
180
170
LST_SIGNALS.extend(['SIGUSR1','SIGQUIT'])
189
179
:param signum: the signal number
192
if tools.config['netrpc']:
194
if tools.config['xmlrpc']:
196
182
netsvc.Agent.quit()
183
netsvc.Server.quitAll()
197
184
if tools.config['pidfile']:
198
185
os.unlink(tools.config['pidfile'])
199
186
logger.notifyChannel('shutdown', netsvc.LOG_INFO,
210
197
fd.write(pidtext)
201
netsvc.Server.startAll()
213
203
logger.notifyChannel("web-services", netsvc.LOG_INFO,
214
204
'the server is running, waiting for connections...')
216
if tools.config['netrpc']:
218
if tools.config['xmlrpc']:
224
209
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: