/usr/share/mythbuntu-bare/bareserver/bareserver.py is in mythbuntu-bare-console 2.2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | #!/usr/bin/env python
## -*- coding: utf-8 -*-
#
# «Bare Server» - The webserver for Mythbuntu Bare console
#
# Copyright (C) 2011, Thomas Mashos, for Mythbuntu
#
#
# Mythbuntu-bare is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this application; if not, write to the Free Software Foundation, Inc., 51
# Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
##################################################################################
from CGIHTTPServer import CGIHTTPRequestHandler
from BaseHTTPServer import HTTPServer
import sys
import os
import logging
import signal
logger = logging.getLogger('mythbuntu-bare')
hdlr = logging.FileHandler('/var/log/mythbuntu-bare-server.log')
formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
hdlr.setFormatter(formatter)
logger.addHandler(hdlr)
logger.setLevel(logging.WARNING)
ACTOR="<Webserver> "
class BareWebserver():
def start_webserver(self, PORT):
cgi_directories = ["/cgi-bin"]
server_address=('',PORT)
os.chdir("/var/lib/mythtv/bare/")
httpd = HTTPServer(server_address, CGIHTTPRequestHandler)
signal.signal(signal.SIGTERM, self.signal_handler)
httpd.serve_forever()
def signal_handler(self, signal, frame):
httpd.server_close()
logger.info(ACTOR+'Stopping BareServer')
sys.exit(0)
if __name__ == "__main__":
import ConfigParser
newconfig = ConfigParser.ConfigParser()
CONFIGFILE = "/var/lib/mythtv/bare/mythbuntu-bare.conf"
logger.info(ACTOR+'Starting BareServer')
try:
newconfig.read(CONFIGFILE)
serverport=int(newconfig.get("General", "serverport"))
logger.info(ACTOR+'Setting communication port to: '+str(serverport))
except:
logger.error(ACTOR+'Cannot find communication port')
sys.exit(1)
try:
BareWebserver().start_webserver(serverport)
logger.info(ACTOR+'Bare Server Started')
except IOError, (value,message):
logger.error(ACTOR+'%s: %s' % (value, message))
sys.exit(1)
|