Symlink cron.daily scripts from /opt/bin.

This commit is contained in:
Darren 'Tadgy' Austin 2023-11-11 21:00:54 +00:00
commit aee5c859f0
6 changed files with 3 additions and 67 deletions

View file

@ -0,0 +1 @@
/opt/bin/cronjob-dehdrated

View file

@ -0,0 +1 @@
/opt/bin/cronjob-update-packages-list

View file

@ -0,0 +1 @@
/opt/bin/cronjob-warn-git-status

View file

@ -1,3 +0,0 @@
#!/bin/bash
/usr/sbin/dehydrated -c >/dev/null

View file

@ -1,26 +0,0 @@
#!/bin/bash
# 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.
. /etc/os-release
# Create package list depending on system type.
case "$ID" in
'slackware')
/usr/sbin/slackpkg -batch=on -default_answer=y generate-template "$(hostname --short)" >/dev/null
;;
'void')
/usr/sbin/xbps-query -l | awk '{ print $2 }' | rev | cut -d- -f2- | rev >/etc/pkglist
;;
*)
printf "%s: %s\\n" "${BASH_SOURCE[0]}" "Unsupported system." >&2
exit 1
;;
esac
exit 0

View file

@ -1,38 +0,0 @@
#!/bin/bash
CHECK_DIRS=( '/' '/etc/slackpkg/templates' )
OUTPUT_FILE="/tmp/${0##*/}-$$-$RANDOM"
# Remove the OUTPUT_FILE when done.
trap 'rm -f "$OUTPUT_FILE"' EXIT
# Source the mail configuration.
source /etc/mail.conf "git-status" 2>/dev/null || {
printf "%s: %s\\n" "${0##*/}" "Failed to source /etc/mail.conf" >&2
exit 1
}
# Loop through the list and process.
for DIR in "${CHECK_DIRS[@]}"; do
[[ ! -e "$DIR" ]] || [[ ! -d "$DIR" ]] && continue
TMP_OUTPUT="$(cd "$DIR" && [[ "$(git rev-parse --show-toplevel)" == "$PWD" ]] && git status | grep -E -ve "^(On branch|Your branch|No commits|nothing|$)" -e "\(use")"
[[ -n "$TMP_OUTPUT" ]] && printf "%s:\\n%s\\n\\n" "$DIR" "$TMP_OUTPUT" >>"$OUTPUT_FILE"
unset TMP_OUTPUT
done
[[ ! -s "$OUTPUT_FILE" ]] && {
exit 0
}
# Send the message.
if [[ -n "${EMAIL_TO[*]}" ]]; then
mailx "${MAILX_ARGS[@]}" -S "from=$EMAIL_FROM" -s "Git statuses" "${EMAIL_TO[@]}" <<<"$(cat "$OUTPUT_FILE")" 2>/dev/null || {
printf "%s: %s\\n" "${0##*/}" "mailx command failed" >&2
exit 1
}
else
printf "%s: %s\\n" "${0##*/}" "no recipient configured for mail delivery" >&2
exit 1
fi
exit 0