Allow long-form parameters.

This commit is contained in:
2025-06-16 14:28:04 -06:00
parent 4469754097
commit 494d0c04bd

View File

@ -4,31 +4,36 @@
# This should be added to root's crontab with the full path, such as:
# */5 * * * * /opt/Docker/Config/Nextcloud/cron.ksh
# Check if a job is already going.
DIR="$(dirname -- "${BASH_SOURCE[0]}")"
PROG="$(basename -- "${BASH_SOURCE[0]}")"
# Check if a job is already going.
RUNNING=`ps -ef | grep $PROG | grep -v grep | grep -v $$ | grep -v "sh -c" | wc -l`
if (( $RUNNING > 0 )); then
exit $RUNNING
fi
# Usage function for when -h or bad parameters are passed.
function usage() {
cat <<- EOF
Script to help with scheduling Nextcloud's cron requirements.
Usage: $PROG [-h|-v]
-h ) Display the usage and help text.
| --help
-v) Pass a verbose request to cron.php.
| --verbose
EOF
exit $1
}
# Check for any parameters.
verbose=""
case "$1" in
"") ;;
"-h")
"-h"|"--help")
usage 0
;;
"-v")
"-v"|"--verbose")
verbose="-v"
;;
*)