-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This patch adds systemd support to SSVP. Fixes: #27 Fixes: #34 Signed-off-by: Amy Parker <[email protected]>
- Loading branch information
Showing
11 changed files
with
254 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[Unit] | ||
Description=ssvp (server statistics viewer project) production server | ||
Documentation=https://ssvp.docs.amyip.net | ||
Conflicts=ssvp-werkzeug | ||
|
||
[Service] | ||
Type=simple | ||
ExecStart=<INSTALLDIR>/venv-wrapper.sh srv/gunicorn.sh | ||
Restart=always | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[Unit] | ||
Description=ssvp (server statistics viewer project) server uptime checker | ||
Documentation=https://ssvp.docs.amyip.net | ||
|
||
[Service] | ||
Type=oneshot | ||
ExecStart=<INSTALLDIR>/venv-wrapper.sh python3 srv/interval.py | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[Unit] | ||
Description=ssvp (server statistics viewer project) server uptime checker | ||
Documentation=https://ssvp.docs.amyip.net | ||
Requires=ssvp-interval.service | ||
|
||
[Timer] | ||
Unit=ssvp-interval.service | ||
OnUnitActiveSec=5min | ||
|
||
[Install] | ||
WantedBy=timers.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[Unit] | ||
Description=ssvp (server statistics viewer project) development server | ||
Documentation=https://ssvp.docs.amyip.net | ||
Conflicts=ssvp-gunicorn | ||
|
||
[Service] | ||
Type=simple | ||
ExecStart=<INSTALLDIR>/venv-wrapper.sh python3 srv/app.py | ||
Restart=always | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/usr/bin/bash | ||
# SPDX-License-Identifier: AGPL-3.0-or-later | ||
# | ||
# ssvp: server statistics viewer project | ||
# Copyright (C) 2023 Amy Parker <[email protected]> | ||
# | ||
# 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, write to the Free Software Foundation, Inc., | ||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA or visit the | ||
# GNU Project at https://gnu.org/licenses. The GNU Affero General Public | ||
# License version 3 is available at, for your convenience, | ||
# https://www.gnu.org/licenses/agpl-3.0.en.html. | ||
|
||
set -e | ||
|
||
cd "$(dirname "$0")" | ||
|
||
echo "SSVP Uninstaller - cleanly uninstalls SSVP" | ||
|
||
if [ $(id -u) -ne 0 ]; then | ||
which sudo > /dev/null | ||
if [ $? -ne 0 ]; then | ||
which doas > /dev/null | ||
if [ $? -ne 0 ]; then | ||
echo "Either run as root, or have sudo installed" | ||
exit 1 | ||
else | ||
PREROOT="doas" | ||
fi | ||
else | ||
PREROOT="sudo" | ||
fi | ||
fi | ||
|
||
echo -n "Installation directory: [none] " | ||
read INSDIR | ||
if [ "$INSDIR" != "" ]; then | ||
$PREROOT rm -rf $INSDIR | ||
fi | ||
|
||
which systemctl > /dev/null | ||
if [ $? -eq 0 ]; then | ||
echo -n "Clear systemd? n/[y] " | ||
read CLRSMD | ||
if [ "$CLRSMD" != "n" ]; then | ||
set +e | ||
for i in ssvp-gunicorn.service ssvp-interval.service ssvp-interval.timer ssvp-werkzeug.service; do | ||
# --now was causing systemctl to hang, so do it manually | ||
$PREROOT systemctl disable $i | ||
$PREROOT systemctl stop $i | ||
$PREROOT rm -f /usr/lib/systemd/system/$i | ||
done | ||
set -e | ||
fi | ||
fi | ||
|
||
echo "Uninstall complete." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/bash | ||
# SPDX-License-Identifier: AGPL-3.0-or-later | ||
# | ||
# ssvp: server statistics viewer project | ||
# Copyright (C) 2023 Amy Parker <[email protected]> | ||
# | ||
# 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, write to the Free Software Foundation, Inc., | ||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA or visit the | ||
# GNU Project at https://gnu.org/licenses. The GNU Affero General Public | ||
# License version 3 is available at, for your convenience, | ||
# https://www.gnu.org/licenses/agpl-3.0.en.html. | ||
|
||
set -e | ||
|
||
cd "$(dirname "$0")" | ||
|
||
source venv/bin/activate | ||
|
||
${@: 1} |