mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-08-26 12:46:08 +00:00
Don't write to PID file
When running under systemd, PID is known and maintained by systemd. Process don't have write PIDs to a PID file.
This commit is contained in:
parent
1f53321b51
commit
9078ec5a2b
@ -4,7 +4,6 @@ file_root = /usr/share/plinth
|
|||||||
config_dir = /etc/plinth
|
config_dir = /etc/plinth
|
||||||
data_dir = /var/lib/plinth
|
data_dir = /var/lib/plinth
|
||||||
log_dir = /var/log/plinth
|
log_dir = /var/log/plinth
|
||||||
pid_dir = /var/run
|
|
||||||
server_dir = /plinth
|
server_dir = /plinth
|
||||||
actions_dir = /usr/share/plinth/actions
|
actions_dir = /usr/share/plinth/actions
|
||||||
doc_dir = /usr/share/doc/plinth
|
doc_dir = /usr/share/doc/plinth
|
||||||
@ -13,7 +12,6 @@ doc_dir = /usr/share/doc/plinth
|
|||||||
store_file = %(data_dir)s/plinth.sqlite3
|
store_file = %(data_dir)s/plinth.sqlite3
|
||||||
status_log_file = %(log_dir)s/status.log
|
status_log_file = %(log_dir)s/status.log
|
||||||
access_log_file = %(log_dir)s/access.log
|
access_log_file = %(log_dir)s/access.log
|
||||||
pidfile = %(pid_dir)s/plinth.pid
|
|
||||||
|
|
||||||
[Network]
|
[Network]
|
||||||
host = 127.0.0.1
|
host = 127.0.0.1
|
||||||
|
|||||||
@ -4,7 +4,6 @@ file_root = %(root)s
|
|||||||
config_dir = %(file_root)s/data/etc/plinth
|
config_dir = %(file_root)s/data/etc/plinth
|
||||||
data_dir = %(file_root)s/data/var/lib/plinth
|
data_dir = %(file_root)s/data/var/lib/plinth
|
||||||
log_dir = %(file_root)s/data/var/log/plinth
|
log_dir = %(file_root)s/data/var/log/plinth
|
||||||
pid_dir = %(file_root)s/data/var/run
|
|
||||||
server_dir = /
|
server_dir = /
|
||||||
actions_dir = %(file_root)s/actions
|
actions_dir = %(file_root)s/actions
|
||||||
doc_dir = %(file_root)s/doc
|
doc_dir = %(file_root)s/doc
|
||||||
@ -13,7 +12,6 @@ doc_dir = %(file_root)s/doc
|
|||||||
store_file = %(data_dir)s/plinth.sqlite3
|
store_file = %(data_dir)s/plinth.sqlite3
|
||||||
status_log_file = %(log_dir)s/status.log
|
status_log_file = %(log_dir)s/status.log
|
||||||
access_log_file = %(log_dir)s/access.log
|
access_log_file = %(log_dir)s/access.log
|
||||||
pidfile = %(pid_dir)s/plinth.pid
|
|
||||||
|
|
||||||
[Network]
|
[Network]
|
||||||
host = 127.0.0.1
|
host = 127.0.0.1
|
||||||
|
|||||||
@ -45,9 +45,6 @@ def parse_arguments():
|
|||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description='Plinth web interface for FreedomBox',
|
description='Plinth web interface for FreedomBox',
|
||||||
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
||||||
parser.add_argument(
|
|
||||||
'--pidfile', default=cfg.pidfile,
|
|
||||||
help='specify a file in which the server may write its pid')
|
|
||||||
# TODO: server_dir is actually a url prefix; use a better variable name
|
# TODO: server_dir is actually a url prefix; use a better variable name
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--server_dir', default=cfg.server_dir,
|
'--server_dir', default=cfg.server_dir,
|
||||||
@ -64,7 +61,6 @@ def parse_arguments():
|
|||||||
|
|
||||||
global arguments
|
global arguments
|
||||||
arguments = parser.parse_args()
|
arguments = parser.parse_args()
|
||||||
cfg.pidfile = arguments.pidfile
|
|
||||||
cfg.server_dir = arguments.server_dir
|
cfg.server_dir = arguments.server_dir
|
||||||
cfg.debug = arguments.debug
|
cfg.debug = arguments.debug
|
||||||
|
|
||||||
@ -82,22 +78,14 @@ def setup_server():
|
|||||||
"""Setup CherryPy server"""
|
"""Setup CherryPy server"""
|
||||||
logger.info('Setting up CherryPy server')
|
logger.info('Setting up CherryPy server')
|
||||||
|
|
||||||
# Set the PID file path
|
|
||||||
try:
|
|
||||||
if cfg.pidfile:
|
|
||||||
from cherrypy.process.plugins import PIDFile
|
|
||||||
PIDFile(cherrypy.engine, cfg.pidfile).subscribe()
|
|
||||||
except AttributeError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
# Configure default server
|
# Configure default server
|
||||||
cherrypy.config.update(
|
cherrypy.config.update({
|
||||||
{'server.socket_host': cfg.host,
|
'server.socket_host': cfg.host,
|
||||||
'server.socket_port': cfg.port,
|
'server.socket_port': cfg.port,
|
||||||
'server.thread_pool': 10,
|
'server.thread_pool': 10,
|
||||||
# Avoid stating files once per second in production
|
# Avoid stating files once per second in production
|
||||||
'engine.autoreload.on': cfg.debug,
|
'engine.autoreload.on': cfg.debug,
|
||||||
})
|
})
|
||||||
|
|
||||||
application = django.core.wsgi.get_wsgi_application()
|
application = django.core.wsgi.get_wsgi_application()
|
||||||
cherrypy.tree.graft(application, cfg.server_dir)
|
cherrypy.tree.graft(application, cfg.server_dir)
|
||||||
|
|||||||
@ -33,7 +33,6 @@ actions_dir = None
|
|||||||
doc_dir = None
|
doc_dir = None
|
||||||
status_log_file = None
|
status_log_file = None
|
||||||
access_log_file = None
|
access_log_file = None
|
||||||
pidfile = None
|
|
||||||
host = None
|
host = None
|
||||||
port = None
|
port = None
|
||||||
use_x_forwarded_host = False
|
use_x_forwarded_host = False
|
||||||
@ -91,7 +90,6 @@ def read(file_path=None, root_directory=None):
|
|||||||
('Path', 'doc_dir', 'string'),
|
('Path', 'doc_dir', 'string'),
|
||||||
('Path', 'status_log_file', 'string'),
|
('Path', 'status_log_file', 'string'),
|
||||||
('Path', 'access_log_file', 'string'),
|
('Path', 'access_log_file', 'string'),
|
||||||
('Path', 'pidfile', 'string'),
|
|
||||||
('Path', 'server_dir', 'string'),
|
('Path', 'server_dir', 'string'),
|
||||||
('Network', 'host', 'string'),
|
('Network', 'host', 'string'),
|
||||||
('Network', 'port', 'int'),
|
('Network', 'port', 'int'),
|
||||||
|
|||||||
@ -126,7 +126,7 @@ class TestCfg(unittest.TestCase):
|
|||||||
"""Compare two sets of configuration values."""
|
"""Compare two sets of configuration values."""
|
||||||
# Note that the count of items within each section includes the number
|
# Note that the count of items within each section includes the number
|
||||||
# of default items (1, for 'root').
|
# of default items (1, for 'root').
|
||||||
self.assertEqual(13, len(parser.items('Path')))
|
self.assertEqual(11, len(parser.items('Path')))
|
||||||
self.assertEqual(parser.get('Path', 'root'), cfg.root)
|
self.assertEqual(parser.get('Path', 'root'), cfg.root)
|
||||||
self.assertEqual(parser.get('Path', 'file_root'), cfg.file_root)
|
self.assertEqual(parser.get('Path', 'file_root'), cfg.file_root)
|
||||||
self.assertEqual(parser.get('Path', 'config_dir'), cfg.config_dir)
|
self.assertEqual(parser.get('Path', 'config_dir'), cfg.config_dir)
|
||||||
@ -139,7 +139,6 @@ class TestCfg(unittest.TestCase):
|
|||||||
cfg.status_log_file)
|
cfg.status_log_file)
|
||||||
self.assertEqual(parser.get('Path', 'access_log_file'),
|
self.assertEqual(parser.get('Path', 'access_log_file'),
|
||||||
cfg.access_log_file)
|
cfg.access_log_file)
|
||||||
self.assertEqual(parser.get('Path', 'pidfile'), cfg.pidfile)
|
|
||||||
|
|
||||||
self.assertEqual(5, len(parser.items('Network')))
|
self.assertEqual(5, len(parser.items('Network')))
|
||||||
self.assertEqual(parser.get('Network', 'host'), cfg.host)
|
self.assertEqual(parser.get('Network', 'host'), cfg.host)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user