From 3d90a16f3e87bd739c8c77edc7b87a26c1c36689 Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc kop@karlpinc.com" Date: Wed, 19 Jun 2024 19:59:11 +0000 Subject: [PATCH] Put existing systemd confs in repository --- examples/systemd/needrestart_report.service | 10 +++++++ examples/systemd/needrestart_report.timer | 14 +++++++++ examples/systemd/pgadmin4_gnunicorn.service | 30 ++++++++++++++++++++ examples/systemd/sokwedb-venv-report.service | 9 ++++++ examples/systemd/sokwedb-venv-report.timer | 10 +++++++ 5 files changed, 73 insertions(+) create mode 100644 examples/systemd/needrestart_report.service create mode 100644 examples/systemd/needrestart_report.timer create mode 100644 examples/systemd/pgadmin4_gnunicorn.service create mode 100644 examples/systemd/sokwedb-venv-report.service create mode 100644 examples/systemd/sokwedb-venv-report.timer diff --git a/examples/systemd/needrestart_report.service b/examples/systemd/needrestart_report.service new file mode 100644 index 0000000..64f46f9 --- /dev/null +++ b/examples/systemd/needrestart_report.service @@ -0,0 +1,10 @@ +[Unit] +Description=Daily report on OS reboot needs after kernel upgrades, and services needing restart after libarary upgrades +Documentation=man:needrestart(1) +ConditionACPower=true + +[Service] +Type=oneshot +ExecStart=/usr/local/sbin/needrestart_report +KillMode=process +TimeoutStopSec=900 diff --git a/examples/systemd/needrestart_report.timer b/examples/systemd/needrestart_report.timer new file mode 100644 index 0000000..47962c5 --- /dev/null +++ b/examples/systemd/needrestart_report.timer @@ -0,0 +1,14 @@ +[Unit] +Description=Description=Daily report on OS reboot needs after kernel upgrades, and services needing restart after libarary upgrades +After=apt-daily-upgrade.timer + +[Timer] +# There seems to be a problem ensuring that the report runs after +# the system updates. Kludge by starting at 7:00, 1 hour after +# the apt-daily-upgrade.timer. +OnCalendar=*-*-* 7:00 +RandomizedDelaySec=60m +Persistent=true + +[Install] +WantedBy=timers.target apt-daily-upgrade.timer diff --git a/examples/systemd/pgadmin4_gnunicorn.service b/examples/systemd/pgadmin4_gnunicorn.service new file mode 100644 index 0000000..d6af0e1 --- /dev/null +++ b/examples/systemd/pgadmin4_gnunicorn.service @@ -0,0 +1,30 @@ +[Unit] +Description=Run the gunicorn http server to serve pgadmin4 +# See also: https://www.pgadmin.org/download/pgadmin-4-python/ +# (Installation is a wheel from pypi.) +# Note: /var/lib/pgadmin4 is a symlink. +ConditionACPower=true +After=network.target + +[Service] +PermissionsStartOnly = true +PIDFile = /run/pgadmin4_gunicorn/pg_admin4_gunicorn.pid +User = pgadmin4 +Group = pgadmin4 +WorkingDirectory = /var/www +ExecStartPre = /bin/mkdir /run/pgadmin4_gunicorn +ExecStartPre = /bin/chown -R pgadmin4:pgadmin4 /run/pgadmin4_gunicorn +ExecStart=/srv/venvs/pgadmin4/bin/gunicorn \ + --bind unix:/run/pgadmin4_gunicorn/pgadmin4.sock \ + --pid /run/pgadmin4_gunicorn/pgadmin4_gunicorn.pid \ + --workers=1 \ + --threads=25 \ + pgadmin4.pgAdmin4:app +ExecReload = /bin/kill -s HUP $MAINPID +ExecStop = /bin/kill -s TERM $MAINPID +ExecStopPost = /bin/rm -rf /run/pgadmin4_gunicorn +PrivateTmp = true + +[Install] +WantedBy = multi-user.target +WantedBy=nginx.service diff --git a/examples/systemd/sokwedb-venv-report.service b/examples/systemd/sokwedb-venv-report.service new file mode 100644 index 0000000..3b1f15f --- /dev/null +++ b/examples/systemd/sokwedb-venv-report.service @@ -0,0 +1,9 @@ +[Unit] +Description=Daily report on outdated packages in Python virtual environments +ConditionACPower=true + +[Service] +Type=oneshot +ExecStart=/usr/local/bin/sokwedb-venv-report +KillMode=process +TimeoutStopSec=900 diff --git a/examples/systemd/sokwedb-venv-report.timer b/examples/systemd/sokwedb-venv-report.timer new file mode 100644 index 0000000..c3fd4e1 --- /dev/null +++ b/examples/systemd/sokwedb-venv-report.timer @@ -0,0 +1,10 @@ +[Unit] +Description=Description=Daily report on outdated packages in Python virtual environments + +[Timer] +OnCalendar=*-*-* 6:00 +RandomizedDelaySec=60m +Persistent=true + +[Install] +WantedBy=timers.target -- 2.34.1