mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-07-22 11:59:33 +00:00
Don't use init.d file, don't daemonize
We pretty much only run in systemd environment and I don't see that changing any time soon. By relying on it, we can reduce some burden. Remove init script. Daemonizing is not needed for systemd. Remove code related daemonization.
This commit is contained in:
parent
f6884a18fa
commit
1f53321b51
2
HACKING
2
HACKING
@ -18,7 +18,7 @@
|
||||
2. Plinth also support running without installing (as much as possible).
|
||||
Simply run it as:
|
||||
|
||||
$ sudo ./run --no-daemon --debug
|
||||
$ sudo ./run --debug
|
||||
|
||||
In this mode, Plinth runs in working directory without need for
|
||||
installation. It uses the plinth.conf config file in the working
|
||||
|
||||
@ -1,71 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# This file is part of Plinth.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: plinth
|
||||
# Required-Start: $network $remote_fs $syslog
|
||||
# Required-Stop: $remote_fs $syslog
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: plinth web frontend
|
||||
# Description:
|
||||
# Control the plinth web frontend.
|
||||
### END INIT INFO
|
||||
|
||||
# This file is /etc/init.d/plinth
|
||||
|
||||
DESC="embedded web frontend"
|
||||
NAME=plinth
|
||||
|
||||
DAEMON=/usr/bin/plinth
|
||||
PID_FILE=/var/run/plinth.pid
|
||||
SERVER_DIR=/plinth
|
||||
|
||||
PLINTH_USER=plinth
|
||||
PLINTH_GROUP=plinth
|
||||
|
||||
test -x $DAEMON || exit 0
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
log_daemon_msg "Starting $DESC" "$NAME"
|
||||
start_daemon -p $PID_FILE $DAEMON --pidfile=$PID_FILE \
|
||||
--server_dir=$SERVER_DIR
|
||||
log_end_msg $?
|
||||
;;
|
||||
stop)
|
||||
log_daemon_msg "Stopping $DESC" "$NAME"
|
||||
killproc -p $PID_FILE $DAEMON
|
||||
RETVAL=$?
|
||||
[ $RETVAL -eq 0 ] && [ -e "$PID_FILE" ] && rm -f $PID_FILE
|
||||
log_end_msg $RETVAL
|
||||
;;
|
||||
restart|force-reload)
|
||||
$0 stop
|
||||
$0 start
|
||||
;;
|
||||
status)
|
||||
status_of_proc -p $PID_FILE "$DAEMON" plinth && exit 0 || exit $?
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $NAME {start|stop|restart|force-reload|status}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@ -21,7 +21,7 @@ Documentation=man:plinth(1)
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/plinth --no-daemon
|
||||
ExecStart=/usr/bin/plinth
|
||||
Restart=on-failure
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
|
||||
|
||||
@ -29,7 +29,6 @@ import stat
|
||||
import sys
|
||||
|
||||
import cherrypy
|
||||
from cherrypy.process.plugins import Daemonizer
|
||||
|
||||
from plinth import cfg
|
||||
from plinth import module_loader
|
||||
@ -56,9 +55,6 @@ def parse_arguments():
|
||||
parser.add_argument(
|
||||
'--debug', action='store_true', default=cfg.debug,
|
||||
help='enable debugging and run server *insecurely*')
|
||||
parser.add_argument(
|
||||
'--no-daemon', action='store_true', default=cfg.no_daemon,
|
||||
help='do not start as a daemon')
|
||||
parser.add_argument(
|
||||
'--setup', action='store_true', default=False,
|
||||
help='run setup tasks on all essential modules and exit')
|
||||
@ -71,7 +67,6 @@ def parse_arguments():
|
||||
cfg.pidfile = arguments.pidfile
|
||||
cfg.server_dir = arguments.server_dir
|
||||
cfg.debug = arguments.debug
|
||||
cfg.no_daemon = arguments.no_daemon
|
||||
|
||||
|
||||
def setup_logging():
|
||||
@ -81,8 +76,6 @@ def setup_logging():
|
||||
|
||||
cherrypy.log.error_file = cfg.status_log_file
|
||||
cherrypy.log.access_file = cfg.access_log_file
|
||||
if not cfg.no_daemon:
|
||||
cherrypy.log.screen = False
|
||||
|
||||
|
||||
def setup_server():
|
||||
@ -152,9 +145,6 @@ def setup_server():
|
||||
logger.debug('Serving static directory %s on %s', static_dir,
|
||||
urlprefix)
|
||||
|
||||
if not cfg.no_daemon:
|
||||
Daemonizer(cherrypy.engine).subscribe()
|
||||
|
||||
cherrypy.engine.signal_handler.subscribe()
|
||||
|
||||
|
||||
|
||||
@ -39,7 +39,6 @@ port = None
|
||||
use_x_forwarded_host = False
|
||||
secure_proxy_ssl_header = None
|
||||
debug = False
|
||||
no_daemon = False
|
||||
server_dir = '/'
|
||||
danube_edition = False
|
||||
|
||||
|
||||
3
setup.py
3
setup.py
@ -193,8 +193,7 @@ setuptools.setup(
|
||||
package_data={'plinth': ['templates/*',
|
||||
'modules/*/templates/*',
|
||||
'locale/*/LC_MESSAGES/*.[pm]o']},
|
||||
data_files=[('/etc/init.d', ['data/etc/init.d/plinth']),
|
||||
('/usr/lib/firewalld/services/',
|
||||
data_files=[('/usr/lib/firewalld/services/',
|
||||
glob.glob('data/usr/lib/firewalld/services/*.xml')),
|
||||
('/usr/lib/freedombox/setup.d/',
|
||||
['data/usr/lib/freedombox/setup.d/86_plinth']),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user