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