From 041ebf1b1aa61d8df1cf8682d41683514fe2f00f Mon Sep 17 00:00:00 2001 From: Darren 'Tadgy' Austin Date: Fri, 22 May 2026 00:27:36 +0100 Subject: [PATCH] Many small updates to various scripts. deleted: cronjob-update-packages-list.new deleted: cronjob-updatedb-mirrors renamed: rsync-notify-upload -> notify-rsync-upload modified: colour-changelog modified: cronjob-clean-php modified: cronjob-dehydrated modified: cronjob-fix-log-acls modified: cronjob-rotate-logs-today-symlink modified: cronjob-update-mirrors-search-db modified: cronjob-update-packages-list modified: cronjob-warn-git-status modified: cronjob-warn-smtp-queue modified: do-backup modified: dovecot-service-checksuspended modified: firewall-initscript modified: git-auto-merge modified: mirror modified: mirror-new-slackware-release.gpg modified: mirror-wrapper modified: notify-rsync-upload modified: sbosrcarch-wrapper --- colour-changelog | 2 +- cronjob-clean-php | 1 + cronjob-dehydrated | 3 +- cronjob-fix-log-acls | 1 + cronjob-rotate-logs-today-symlink | 10 ++++-- cronjob-update-mirrors-search-db | 13 ++++--- cronjob-update-packages-list | 1 + cronjob-update-packages-list.new | 55 ------------------------------ cronjob-updatedb-mirrors | 26 -------------- cronjob-warn-git-status | 4 ++- cronjob-warn-smtp-queue | 22 ++++-------- do-backup | 5 --- dovecot-service-checksuspended | 5 --- firewall-initscript | 1 + git-auto-merge | 5 --- mirror | 1 + mirror-new-slackware-release.gpg | Bin 1178 -> 1072 bytes mirror-wrapper | 5 --- notify-rsync-upload | 48 ++++++++++++++++++++++++++ rsync-notify-upload | 51 --------------------------- sbosrcarch-wrapper | 5 --- 21 files changed, 83 insertions(+), 181 deletions(-) delete mode 100644 cronjob-update-packages-list.new delete mode 100755 cronjob-updatedb-mirrors create mode 100755 notify-rsync-upload delete mode 100755 rsync-notify-upload diff --git a/colour-changelog b/colour-changelog index 92e6233..55bf4b4 100755 --- a/colour-changelog +++ b/colour-changelog @@ -11,7 +11,7 @@ # Defaults. CHANGELOG_URL="https://ftp.osuosl.org/pub/slackware/slackware64-current/ChangeLog.txt" # CHANGELOG_URL="https://slackware.uk/slackware/slackware64-current/ChangeLog.txt" -REFRESH_INTERVAL="600" +REFRESH_INTERVAL="300" MAX_LINES="10000000" # Should cover the whole ChangeLog. # Colourise at most MAX_LINES of the ChangeLog. diff --git a/cronjob-clean-php b/cronjob-clean-php index b47cc39..40010a6 100755 --- a/cronjob-clean-php +++ b/cronjob-clean-php @@ -1,4 +1,5 @@ #!/bin/bash +# Clean up the php session and upload directories. [[ -d /var/lib/php/sessions ]] && find /var/lib/php/sessions -mmin +1440 -type f -print0 | xargs -0 rm -f [[ -d /var/tmp/php-uploads ]] && find /var/tmp/php-uploads -mmin +1440 -type f -print0 | xargs -0 rm -f diff --git a/cronjob-dehydrated b/cronjob-dehydrated index 7afa21c..482fc92 100755 --- a/cronjob-dehydrated +++ b/cronjob-dehydrated @@ -1,5 +1,6 @@ #!/bin/bash -# Run this job in the background. +# Run dehydrated after a delay. + ( # Delay the run for 15 hours (from midnight) and then run at a random time within 3 hours after that. sleep $(( 54000 + (RANDOM % 10800) )) /opt/sbin/dehydrated -c >/dev/null ) & diff --git a/cronjob-fix-log-acls b/cronjob-fix-log-acls index 4313f92..61d2a90 100755 --- a/cronjob-fix-log-acls +++ b/cronjob-fix-log-acls @@ -1,4 +1,5 @@ #!/bin/bash +# Set ACLs on /var/log files and directories. # Sleep for up to a couple of minutes to prevent a race condition with other cron jobs. sleep $(( RANDOM % 120 )) diff --git a/cronjob-rotate-logs-today-symlink b/cronjob-rotate-logs-today-symlink index f59a139..cd54374 100755 --- a/cronjob-rotate-logs-today-symlink +++ b/cronjob-rotate-logs-today-symlink @@ -1,4 +1,5 @@ #!/bin/bash +# Create a new symlink to today's logs, for ease of browsing. # Default configuration. LOGS_DIR="/data/logs" @@ -10,23 +11,28 @@ LOGS_DIR="/data/logs" for DIR in "$LOGS_DIR"/*/; do cd "$DIR" 2>/dev/null || { printf "%s: %s\\n" "${0##*/}" "failed to change directory to '$DIR'" >&2 + ERR=1 continue } + # Logs are for root only. + umask 022 + # Create the new days' location. - umask 0755 # shellcheck disable=SC2174 mkdir -p -m 0755 "$LOGS_DIR/$TODAY" 2>/dev/null || { printf "%s: %s\\n" "${0##*/}" "failed to create directory '$LOGS_DIR/$TODAY'" >&2 + ERR=1 continue } # Create the 'today' symlink to the new location. ln -sfn "$TODAY" "today" 2>/dev/null || { printf "%s: %s\\n" "${0##*/}" "updating 'today' symlink failed in '$DIR'" >&2 + ERR=1 continue } done } -exit 0 +exit "${ERR:-0}" diff --git a/cronjob-update-mirrors-search-db b/cronjob-update-mirrors-search-db index 9ade33a..b44a3e2 100755 --- a/cronjob-update-mirrors-search-db +++ b/cronjob-update-mirrors-search-db @@ -1,16 +1,21 @@ #!/bin/bash +# Update the 'locate' database used for the search backend on slackware.uk. + +# Default configuration. +SCANDIR="/data/depository" +DBFILE="/data/sites/slackware.uk/files/search.db" RAND="$$$RANDOM" -if ionice -c3 nice -n 19 /opt/bin/updatedb -l no -o /data/sites/slackware.uk/files/search.db.$RAND -U /data/depository >/dev/null 2>&1; then - mv /data/sites/slackware.uk/files/search.db.$RAND /data/sites/slackware.uk/files/search.db 2>/dev/null || { +if ionice -c3 nice -n 19 /opt/bin/updatedb -l no -o "$DBFILE.$RAND" -U "$SCANDIR" >/dev/null 2>&1; then + mv "$DBFILE.$RAND" "$DBFILE" 2>/dev/null || { printf "%s: %s\\n" "${0##*/}" "failed to move mirrors search database into place" >&2 - rm -f /data/sites/slackware.uk/files/search.db.$RAND + rm -f "$DBFILE.$RAND" exit 1 } else printf "%s: %s\\n" "${0##*/}" "mirrors search database update failed" >&2 - rm -f "/data/sites/slackware.uk/files/search.db.$RAND" + rm -f "$DBFILE.$RAND" exit 1 fi diff --git a/cronjob-update-packages-list b/cronjob-update-packages-list index 203c69a..9a63b92 100755 --- a/cronjob-update-packages-list +++ b/cronjob-update-packages-list @@ -1,4 +1,5 @@ #!/bin/bash +# Update the /etc/pkglist file, the record of installed packages on the system. # Check for an /etc/os-release. [[ ! -e /etc/os-release ]] && { diff --git a/cronjob-update-packages-list.new b/cronjob-update-packages-list.new deleted file mode 100644 index 5503f68..0000000 --- a/cronjob-update-packages-list.new +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash - -# FIXME: This is broken. - -# Check for an /etc/os-release. -[[ ! -e /etc/os-release ]] && { - printf "%s: %s\\n" "${BASH_SOURCE[0]}" "No /etc/os-release to determine system." >&2 - exit 1 -} - -# Source system info. -# shellcheck disable=SC1091 -. /etc/os-release - -PKGLIST_CUR_MD5="$(md5sum /etc/pkglist 2>/dev/null)" -TEMPLATE_CUR_MD5="$(md5sum /etc/slackpkg/templates/$(hostname --short).template 2>/dev/null)" - -# Create package list depending on system type. -case "$ID" in - 'alpine') - apk list -I | cut -d' ' -f1 | rev | cut -d- -f3- | rev >/etc/pkglist || exit 1 - ;; - 'debian'|'devuan'|'ubuntu') - dpkg-query --show --showformat='${Package}\n' >/etc/pkglist || exit 1 - ;; - 'slackware') - [[ -L /etc/pkglist ]] && rm -f /etc/pkglist - printf "%s\\n" /var/log/packages/* | rev | cut -d- -f4- | rev >/etc/pkglist || exit 1 - slackpkg -batch=on -default_answer=y generate-template "$(hostname --short)" >/dev/null || exit 1 - ;; - 'void') - xbps-query -l | awk '{ print $2 }' | rev | cut -d- -f2- | rev >/etc/pkglist || exit 1 - ;; - *) - printf "%s: %s\\n" "${BASH_SOURCE[0]}" "Unsupported system." >&2 - exit 1 - ;; -esac - -cd /etc || exot 1 -git rev-parse --show-toplevel >/dev/null 2>&1 && { - [[ -z "$PKGLIST_CUR_MD5" ]] && [[ -e pkglist ]] && { - git add pkglist >/dev/null || exit 1 - } - [[ -z "$TEMPLATE_CUR_MD5" ]] && [[ -e "slackpkg/templates/$(hostname --short).template" ]] && { - git add "slackpkg/templates/$(hostname --short).template" >/dev/null || exit 1 - } - { [[ -e pkglist ]] && [[ "$(md5sum pkglist 2>/dev/null)" != "$PKGLIST_CUR_MD5" ]]; } || \ - { [[ -e "slackpkg/templates/$(hostname --short).template" ]] && \ - [[ "$(md5sum "slackpkg/templates/$(hostname --short).template" 2>/dev/null)" != "$TEMPLATE_CUR_MD5" ]]; } && { - git commit -m "Update pkglist (and/or." pkglist >/dev/null || exit 1 - } -} - -exit 0 diff --git a/cronjob-updatedb-mirrors b/cronjob-updatedb-mirrors deleted file mode 100755 index f4ea9a3..0000000 --- a/cronjob-updatedb-mirrors +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# Version: 0.1.0 -# Copyright (c) 2023: -# Darren 'Tadgy' Austin -# Licensed under the terms of the GNU General Public License version 3. -# -# Update the locate database used specifically for the search interface on slackware.uk. - -# Configuration. -DBFILE="/run/mirrors.db" -FILETREE="/storage/md0" -COMMAND="/usr/bin/updatedb" - -# Sanity check. -[[ ! -x "$COMMAND" ]] && { - printf "%s: '%s' %s\\n" "${0##*/}" "$COMMAND" "is not executable" >&2 - exit 1 -} - -# Update the database. -nice -n 19 ionice -c3 "$COMMAND" -l 0 -o "$DBFILE" -U "$FILETREE" || { - printf "%s: %s\\n" "${0##*/}" "failed to update locate database" >&2 - exit 1 -} - -exit 0 diff --git a/cronjob-warn-git-status b/cronjob-warn-git-status index c4dd959..3a07040 100755 --- a/cronjob-warn-git-status +++ b/cronjob-warn-git-status @@ -1,6 +1,8 @@ #!/bin/bash +# Email the status of various git repositories on the system. -# Configuration. +# Default configuration. +# This can be overridden in /etc/default/warn-git-status. EMAIL_FROM="\"Server: ${HOSTNAME%%.*}\" " EMAIL_TO=("Systems' Administrator ") diff --git a/cronjob-warn-smtp-queue b/cronjob-warn-smtp-queue index f551661..859f2e8 100755 --- a/cronjob-warn-smtp-queue +++ b/cronjob-warn-smtp-queue @@ -1,6 +1,8 @@ #!/bin/bash +# Send an email with the status of the SMTP queue on the system. # Default configuration. +# This can be overridden in /etc/default/warn-smtp-queue. EMAIL_TO=('sysadmin@slackware.uk') EMAIL_FROM="\"Server: ${HOSTNAME%%.*}\" " @@ -24,23 +26,13 @@ hash mailq 2>/dev/null && { [[ -z "$TMP_OUTPUT" ]] && exit 0 # Send the message. - if [[ -n "${EMAIL_TO[*]}" ]]; then - if hash mailx >/dev/null 2>&1; then - mailx -S "from=$EMAIL_FROM" -s "Mail queue" "${EMAIL_TO[@]}" <<<"$TMP_OUTPUT" 2>/dev/null || { - printf "%s: %s\\n" "${0##*/}" "mailx command failed" >&2 - exit 1 - } - elif hash mail >/dev/null 2>&1; then - mail -r "$EMAIL_FROM" -s "Mail queue" "${EMAIL_TO[@]}" <<<"$TMP_OUTPUT" 2>/dev/null || { - printf "%s: %s\\n" "${0##*/}" "mail command failed" >&2 - exit 1 - } - else - printf "%s: %s\\n" "${0##*/}" "no mailer command found" >&2 + if [[ -n "$EMAIL_FROM" ]] && [[ -n "${EMAIL_TO[*]}" ]]; then + mail -r "$EMAIL_FROM" -s "Mail queue" "${EMAIL_TO[@]}" <<<"$TMP_OUTPUT" >/dev/null 2>&1 || { + printf "%s: %s\\n" "${0##*/}" "mail command failed" >&2 exit 1 - fi + } else - printf "%s: %s\\n" "${0##*/}" "no recipient configured for mail delivery" >&2 + printf "%s: %s\\n" "${0##*/}" "no sender and/or recipient configured for mail delivery" >&2 exit 1 fi } diff --git a/do-backup b/do-backup index 0a8e35f..d0c8816 100755 --- a/do-backup +++ b/do-backup @@ -1,9 +1,4 @@ #!/bin/bash -# Version: 0.1.1 -# Copyright (c) 2023: -# Darren 'Tadgy' Austin -# Licensed under the terms of the GNU General Public License version 3. -# # Perform backup tasks in a generic way. # Base configuration. diff --git a/dovecot-service-checksuspended b/dovecot-service-checksuspended index 2af1775..da11b7e 100755 --- a/dovecot-service-checksuspended +++ b/dovecot-service-checksuspended @@ -1,9 +1,4 @@ #!/bin/bash -# Version: 0.1.0 -# Copyright (c) 2023: -# Darren 'Tadgy' Austin -# Licensed under the terms of the GNU General Public License version 3. -# # A Dovecot service script to check whether a domain or user has been suspended from being able to use mail. VIRTUAL_DIR="/etc/virtual" diff --git a/firewall-initscript b/firewall-initscript index 25ee3cd..f19c2f1 100755 --- a/firewall-initscript +++ b/firewall-initscript @@ -1,4 +1,5 @@ #!/bin/bash +# Restore firewall state at boot, and store it at shutdown. ### BEGIN INIT INFO # Provides: firewall # Required-Start: $network diff --git a/git-auto-merge b/git-auto-merge index b993bf9..a2bac87 100755 --- a/git-auto-merge +++ b/git-auto-merge @@ -1,9 +1,4 @@ #!/bin/bash -# Version: 0.1.0 -# Copyright (c) 2023: -# Darren 'Tadgy' Austin -# Licensed under the terms of the GNU General Public License version 3. -# # Automatically fetch and merge (if possible) upstream changes into a local git repository. # What platform we're running on. diff --git a/mirror b/mirror index 965c594..a2cafd7 100755 --- a/mirror +++ b/mirror @@ -1,4 +1,5 @@ #!/bin/bash +# Perform mirroring tasks for slackware.uk. # Version: 0.4.0 # Copyright (c) 2026: # Darren 'Tadgy' Austin diff --git a/mirror-new-slackware-release.gpg b/mirror-new-slackware-release.gpg index 992a9f4c068d05f0e2de6153fd454643028dae43..4fda3fd4f4d34196d1dae7ee03c33fe95a72fe63 100644 GIT binary patch literal 1072 zcmV-01kd}74Fm}T3gPJL08zSK`d)=KMdPF~z91C^G&Of7UsO$t=0)CwAxF}=F@4SqYJFVIi z1|w~%LWfdz(%lGYKVP@Nt%DbP~zyz2ZcU8#;G=b9dvN<}^;^p{C$g zIg^94G&ql7aN-wM^{a17!;_7Xnl|`b;Zy@OjKH+|dC?FFf#QD3$evyag&VBC9Xwr{ zMUFXn1nZWQE*8DWn5XzG;stK1rnIe9Ryc5T_<8|Fjp;%2P06(^Ah@CjVT9%pB}Ok<6LgSOo02VIROx#I(6K2 zRCm~YQd<#k-n~`t>m4zv*u1Cu5z_BKtk9C}9bg*k^AWf1iA-y<`{w#I6%nhz!u9!?KG`|vOgA5k zE7>@Oo*vHvvu>wBd~LXIOvxqI&7WUkw|78Dg~&9o_~Kcj@{9VrQC#Se%L7Cdp3)@o zcuQ!YPX=y3oUWU@U97z$nNj*Zrtm%RR3k56atU$wsM$g|m?NT-)vlr-CSyi1Ea)#w zqdoeocv|!osB^sD8t0LtBwR{~B#Afe~Vfd{=zKMp;ia7GiCcMqDY znBuz(R5t(Zmo`uN5D#lOOf6+7F|=^HLqqyfV^>@x0JmQRFSL}9iM3G8IR|>rmMc=5 zW&!$b{TS?P+t`bi=VKMlNq(BtL4r1G*nh_+I-BDqR7jnvvHS}5xkvX!C?9o(M7=GztRq*0bXueggaQB$-{ zG~DJnOXk3lpk3f`x@-4@qqb*|R3N7td`G4uzF4d{V7xKF>u9VKkhbG_a*wq}Y@_!y_Tw;|>t9pVmUb q@{q~I)TFKj9(A-=MI+K2A9)AeSYN(hjTT}AB~betsZ;YjHF7*0%p5BK literal 1178 zcmV;L1ZDe-4Fm}T3S;&?Vltip(Erlv0blsICjO_an9vcQW^oE+)8-*IAo-SbFUX&K ztHnYKxWTm=`2RnBD};oKItY-H^~UpA%tdW~&r6X!9I3<5H(G-q^xky;uP*pA{^$_< zs9O%KO@|;3JXPGTPkoR&z9Xj(@Osa*Q$p=#49&#ZarrfOo6sL!*fy^|Fp2vr- zWQbo^-gCe$$VkzrW!3YlQ`Y`9`s~K(IH%J*ksZ0QFdr3H7Np zg}9YnL|KZ2qZ;LS+B}n zNb5xGaJ?|hiu8d2E4JjhVdaah$K#$lbyy1Yf^vjzOI`W+sQxLi$IKTv+K0+L6kHG8 z%`PY58GOiQpvjk+r{e_`03F9hbgufrYR*lI-{|BGgqplR-eRKm#h$a6EjcPyMtobC zq-VT6yd?s{$b4nAr=>Zhb@J74vn+#p`zi*yTz9_5@3D_HA|+#H%2z1o-RlE6hT45t zOzvOw2}JB{Ud-Y~hP_S8QkD69iWZ1Es!fUFB&js1Hp!Zsy6!kCrNlHv$wa@3;%2xV zi%o*p^|OSrWZO-C1uaIDh!V40oXY0;WktGgB1iTW%pyJwnK2+54`mRIKk4<(izc#2 z?^QHNc0{lAgtIvv#%$N>OzNzOgOZQlq<#O(` zU!8AzW<`Yi*;kQ~lCzjahmnm;!I%P=Go#42XnG6lqM9fpJgK s-s%%jam-8}(rWEUWL1%^a_yN|l0%lm2#*c2gR{4rLKkFc$K|Ij#6(_KH~;_u diff --git a/mirror-wrapper b/mirror-wrapper index d9de8a5..812479e 100755 --- a/mirror-wrapper +++ b/mirror-wrapper @@ -1,9 +1,4 @@ #!/bin/bash -# Version: 0.2.1 -# Copyright (c) 2023-2026: -# Darren 'Tadgy' Austin -# Licensed under the terms of the GNU General Public License version 3. -# # Wrapper around /opt/bin/mirror to keep a log of the mirroring session, and email it. # Configuration. diff --git a/notify-rsync-upload b/notify-rsync-upload new file mode 100755 index 0000000..d271c41 --- /dev/null +++ b/notify-rsync-upload @@ -0,0 +1,48 @@ +#!/bin/bash +# Send an email notification whenever someone pushes an update to rsyncd. + +# Default configuration. +# This can be overridden in /etc/default/notify-rsync-upload. +EMAIL_FROM="\"Server: ${HOSTNAME%%.*}\" " +EMAIL_TO=("Systems' Administrator ") +LOGSDIR="/var/log/duplication/rsync-uploads" + +# Read /etc/default/notify-rsync-upload if it exists. +[[ -e /etc/default/notify-rsync-upload ]] && { + # shellcheck disable=SC1091 + source /etc/default/notify-rsync-upload || { + printf "%s: %s\\n" "${0##*/}" "failed reading /etc/default/notify-rsync-upload" >&2 + exit 1 + } +} + +# Make sure the logs directory exists. +mkdir -p "$LOGSDIR" 2>/dev/null || { + printf "%s: %s\\n" "${0##*/}" "Failed to create logs directory" >&2 + exit 1 +} + +# Update the log with this upload date/time. +printf "%s - %s\\n" "$(printf "%(%c)T")" "{RSYNC_USER_NAME:-(none)}@${RSYNC_HOST_NAME:-$RSYNC_HOST_ADDR}" >>"$LOGSDIR/${RSYNC_MODULE_NAME%%-upload}" + +# Determine the subject of the message. +if (( RSYNC_EXIT_STATUS == 0 )); then + EMAIL_SUBJECT="Upload success: ${RSYNC_MODULE_NAME%%-upload}" +elif (( RSYNC_EXIT_STATUS == -1 )); then + EMAIL_SUBJECT="Upload error: ${RSYNC_MODULE_NAME%%-upload}" +else + EMAIL_SUBJECT="Upload failure: ${RSYNC_MODULE_NAME%%-upload}" +fi + +# Send the message. +if [[ -n "$EMAIL_FROM" ]] && (( "${#EMAIL_TO[@]}" != 0 )); then + printf "%s:\\t%s\\n%s:\\t\\t%s\\n%s:\\t%s\\n%s:\\t\\t%s\\n" "Auth'd user" "$RSYNC_USER_NAME@$RSYNC_HOST_NAME [$RSYNC_HOST_ADDR]" "Module" "$RSYNC_MODULE_NAME ($RSYNC_MODULE_PATH)" "Exit code" "$RSYNC_EXIT_STATUS" "PID" "$RSYNC_PID" | mail -r "$EMAIL_FROM" -s "$EMAIL_SUBJECT" "${EMAIL_TO[@]}" >/dev/null 2>&1 || { + printf "%s: %s\\n" "${0##*/}" "mail command failed" >&2 + exit 1 + } +else + printf "%s: %s\\n" "${0##*/}" "no sender and/or recipient configured for mail delivery" >&2 + exit 1 +fi + +exit 0 diff --git a/rsync-notify-upload b/rsync-notify-upload deleted file mode 100755 index 31c536f..0000000 --- a/rsync-notify-upload +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -# Version: 0.1.0 -# Copyright (c) 2023: -# Darren 'Tadgy' Austin -# Licensed under the terms of the GNU General Public License version 3. -# -# Send an email notification whenever someone pushes an update to rsync. -# shellcheck disable=SC2154 - -# Configuration. -LOGSDIR="/var/log/suplication/rsync-uploads" - -# Source the mail configuration. -source /etc/mail.conf "notify-upload" 2>/dev/null || { - printf "%s: %s\\n" "${0##*/}" "Failed to source /etc/mail.conf" >&2 - exit 1 -} - -# Make sure the logs directory exists. -mkdir -p "$LOGSDIR" 2>/dev/null || { - printf "%s: %s\\n" "${0##*/}" "Failed to create logs directory" >&2 - exit 1 -} - -# Update the log with this upload date/time. -printf "%s - %s\\n" "$(date)" "{RSYNC_USER_NAME:-(none)}@${RSYNC_HOST_NAME:-$RSYNC_HOST_ADDR}" >>"$LOGSDIR/${RSYNC_MODULE_NAME%%-upload}" - -# Determine the subject of the message. -if (( RSYNC_EXIT_STATUS == 0 )); then - EMAIL_SUBJECT="Upload success: ${RSYNC_MODULE_NAME%%-upload}" -elif (( RSYNC_EXIT_STATUS == -1 )); then - EMAIL_SUBJECT="Upload error: ${RSYNC_MODULE_NAME%%-upload}" -else - EMAIL_SUBJECT="Upload failure: ${RSYNC_MODULE_NAME%%-upload}" -fi - -# Send the message. -if [[ -n "${EMAIL_TO[*]}" ]]; then - mailx "${MAILX_ARGS[@]}" -S "from=$EMAIL_FROM" -s "$EMAIL_SUBJECT" "${EMAIL_TO[@]}" <<-EOF 2>/dev/null || \ - { printf "%s: %s\\n" "${0##*/}" "mailx command failed" >&2; RET=1; } - Auth'd User: $RSYNC_USER_NAME@$RSYNC_HOST_NAME [$RSYNC_HOST_ADDR] - Module: $RSYNC_MODULE_NAME ($RSYNC_MODULE_PATH) - Exit code: $RSYNC_EXIT_STATUS - PID: $RSYNC_PID - EOF -else - printf "%s: %s\\n" "${0##*/}" "no recipient configured for mail delivery" >&2 - RET=1 -fi - -exit "${RET:-0}" diff --git a/sbosrcarch-wrapper b/sbosrcarch-wrapper index 55fe5fa..9f16a9d 100755 --- a/sbosrcarch-wrapper +++ b/sbosrcarch-wrapper @@ -1,9 +1,4 @@ #!/bin/bash -# Version: 0.2.0 -# Copyright (c) 2023-2026: -# Darren 'Tadgy' Austin -# Licensed under the terms of the GNU General Public License version 3. -# # Wrapper around /opt/bin/sbosrcarch to keep a log of the session, and email it. # Configuration.