Add systemd service file

- When running in an environment without systemd, the changes are completely
  ignored.

- When running under systemd, the patch introduces a systemd native service
  file to take advantages of nice feature provided by systemd.

- One of the feature currently taken advantage of is the ability to restart the
  service automatically if it ever crashes or exits with error.

- Another feature is that when we wish to kill Plinth all the processes under
  the cgroup are killed as well.
This commit is contained in:
Sunil Mohan Adapa 2015-02-14 18:58:16 +05:30
parent 13e0707b09
commit 2a83f29b8b
2 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,29 @@
#
# 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/>.
#
[Unit]
Description=Plinth Web Interface
Documentation=man:plinth(1)
After=network.target
[Service]
ExecStart=/usr/bin/plinth --no-daemon
Restart=on-failure
ExecReload=/bin/kill -HUP $MAINPID
[Install]
WantedBy=multi-user.target

View File

@ -133,6 +133,8 @@ setuptools.setup(
['data/etc/apache2/sites-available/plinth.conf',
'data/etc/apache2/sites-available/plinth-ssl.conf']),
('/etc/sudoers.d', ['data/etc/sudoers.d/plinth']),
('/lib/systemd/system',
['data/lib/systemd/system/plinth.service']),
('/usr/share/plinth/actions',
glob.glob(os.path.join('actions', '*'))),
('/usr/share/man/man1', ['doc/plinth.1']),