From 494d0c04bdce53c91efb25bd4da3ba23975cb09e Mon Sep 17 00:00:00 2001 From: Hyperling Date: Mon, 16 Jun 2025 14:28:04 -0600 Subject: [PATCH] Allow long-form parameters. --- Config/Nextcloud/cron.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Config/Nextcloud/cron.sh b/Config/Nextcloud/cron.sh index 1a40354..6e5d239 100755 --- a/Config/Nextcloud/cron.sh +++ b/Config/Nextcloud/cron.sh @@ -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. + -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" ;; *)