#!/bin/bash # # Maintenence operations at reboot. # This script called usually by the cron. # # Author: Kovács Zoltán # Kovács Zoltán # License: GNU/GPL v3+ (https://www.gnu.org/licenses/gpl-3.0.en.html) # 2023-06-18 v1.0 # new: forked from the "Smartfront's DOCKER_skeleton" repository. # 2021.08-30 v0.1 Initial release # Messages. # MSG_MISSINGDEP="Fatal: missing dependency" # Checks the dependencies. # TR=$(which tr 2>/dev/null) if [ -z "$TR" ]; then echo "$MSG_MISSINGDEP tr."; exit 1 ; fi for item in basename cut dirname readlink do if [ -n "$(which $item)" ] then export $(echo $item | "$TR" '[:lower:]' '[:upper:]')=$(which $item) else echo "$MSG_MISSINGDEP $item." >&2; exit 1; fi done # All dependencies are available via "$THECOMMAND" (upper case) call. # Where I'm? # https://gist.github.com/TheMengzor/968e5ea87e99d9c41782 SOURCE="${BASH_SOURCE[0]}" while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink SCRPATH="$( cd -P "$( "$DIRNAME" "$SOURCE" )" && pwd )" #" SOURCE="$("$READLINK" "$SOURCE")" # if $SOURCE was a relative symlink, we need to resolve it # relative to the path where the symlink file was located [[ $SOURCE != /* ]] && SOURCE="$SCRPATH/$SOURCE" done; SCRPATH="$( cd -P "$( "$DIRNAME" "$SOURCE" )" && pwd )" #" SCRFILE="$("$BASENAME" "$(test -L "$0" && "$READLINK" "$0" || echo "$0")")" #" # Actually this job does nothing.