znc fixes
authorIan Kelling <ian@iankelling.org>
Mon, 18 Nov 2024 22:58:49 +0000 (17:58 -0500)
committerIan Kelling <ian@iankelling.org>
Mon, 18 Nov 2024 23:00:11 +0000 (18:00 -0500)
filesystem/etc/systemd/system/znc.service.d/override.conf [new file with mode: 0644]
machine_specific/li/filesystem/etc/systemd/system/znc.service [deleted file]
znc-start-delay [new file with mode: 0755]

diff --git a/filesystem/etc/systemd/system/znc.service.d/override.conf b/filesystem/etc/systemd/system/znc.service.d/override.conf
new file mode 100644 (file)
index 0000000..a69bdc3
--- /dev/null
@@ -0,0 +1,2 @@
+[Service]
+ExecStartPre=/a/c/znc-start-delay
diff --git a/machine_specific/li/filesystem/etc/systemd/system/znc.service b/machine_specific/li/filesystem/etc/systemd/system/znc.service
deleted file mode 100644 (file)
index 31c2a4a..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-[Unit]
-Description=ZNC, an advanced IRC bouncer
-After=network-online.target
-
-[Service]
-ExecStart=/usr/bin/znc -f --datadir=/var/lib/znc
-User=znc
-
-[Install]
-WantedBy=multi-user.target
diff --git a/znc-start-delay b/znc-start-delay
new file mode 100755 (executable)
index 0000000..9402e13
--- /dev/null
@@ -0,0 +1,36 @@
+#!/bin/bash
+# I, Ian Kelling, follow the GNU license recommendations at
+# https://www.gnu.org/licenses/license-recommendations.en.html. They
+# recommend that small programs, < 300 lines, be licensed under the
+# Apache License 2.0. This file contains or is part of one or more small
+# programs. If a small program grows beyond 300 lines, I plan to change
+# to a recommended GPL license.
+
+# Copyright 2024 Ian Kelling
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+
+#     http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+set -e; . /usr/local/lib/bash-bear; set +e
+
+# with libera.chat, restarting znc, due to reboot, being down 35
+# seconds, i fail to get primary username. So, lets just bump that to 2
+# minutes and see if that fixes things.
+
+# first field as an integer.
+up_secs=$(sed 's/[^0-9].*//' /proc/uptime)
+
+delay=$(( 120 - up_secs ))
+
+if (( delay > 0 )); then
+  sleep $delay
+fi