Commit 8105faa7 authored by Leigh B Stoller's avatar Leigh B Stoller

Wrap the ssl XMLRPC server with daemon_wrapper in case it dies cause of

a database failure.
parent f442e091
......@@ -73,8 +73,16 @@ case "$1" in
if [ -x @prefix@/sbin/sslxmlrpc_server.py ]; then
echo -n " sslxmlrpc_server"
if [ -x @prefix@/sbin/daemon_wrapper ]; then
@prefix@/sbin/daemon_wrapper -i 30 \
-l @prefix@/log/sslxmlrpc_server.log \
-p /var/run/sslxmlrpc_server.pid \
@prefix@/sbin/sslxmlrpc_server.py -f
else
@prefix@/sbin/sslxmlrpc_server.py 2>/dev/null
fi
fi
# mfrisbeed started with its own script
......
......@@ -48,6 +48,9 @@ from libdb import *
# When debugging, runs in foreground printing to stdout instead of syslog
debug = 0
# For daemon wrapper, run in foreground mode.
foreground = 0
# The port to listen on. We should get this from configure.
PORT = 3069
......@@ -618,8 +621,8 @@ class MyServer(SocketServer.ForkingTCPServer, SimpleXMLRPCDispatcher):
try:
# Parse the options,
opts, req_args = getopt.getopt(sys.argv[1:],
"dhs:p:c:",
[ "debug", "help", "server=", "port=",
"dhs:p:c:f",
[ "debug", "foreground", "help", "server=", "port=",
"cert=", "cacert=" ])
# ... act on them appropriately, and
for opt, val in opts:
......@@ -643,6 +646,9 @@ try:
elif opt in ("-d", "--debug"):
debug = 1
pass
elif opt in ("-f", "--foreground"):
foreground = 1
pass
elif opt in ("-c", "--cert"):
server_cert = val
pass
......@@ -668,8 +674,10 @@ if not debug:
getattr(syslog, "LOG_" + string.upper(LOGFACIL)))
syslog.syslog(syslog.LOG_INFO, "SSL XMLRPC server starting up");
# We use foreground mode from daemon_wrapper.
if not foreground:
#
# Daemonize. We redirect our output into a log file cause I have no
# We redirect our output into a log file cause I have no
# idea what is going to use plain print.
#
try:
......@@ -689,6 +697,7 @@ if not debug:
sys.exit(0)
pass
os.setsid();
pass
else:
print "SSL XMLRPC server starting up"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment