From 184857c94a30a2a63f38278fa28b235075b1dfe7 Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Mon, 18 Nov 2024 17:58:49 -0500 Subject: [PATCH] znc fixes --- .../system/znc.service.d/override.conf | 2 ++ .../filesystem/etc/systemd/system/znc.service | 10 ------ znc-start-delay | 36 +++++++++++++++++++ 3 files changed, 38 insertions(+), 10 deletions(-) create mode 100644 filesystem/etc/systemd/system/znc.service.d/override.conf delete mode 100644 machine_specific/li/filesystem/etc/systemd/system/znc.service create mode 100755 znc-start-delay 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 index 0000000..a69bdc3 --- /dev/null +++ b/filesystem/etc/systemd/system/znc.service.d/override.conf @@ -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 index 31c2a4a..0000000 --- a/machine_specific/li/filesystem/etc/systemd/system/znc.service +++ /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 index 0000000..9402e13 --- /dev/null +++ b/znc-start-delay @@ -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 -- 2.30.2