Added --noconf option to the rotate_folder script.
This commit is contained in:
		@@ -55,6 +55,9 @@
 | 
			
		||||
# Author: Kovács Zoltán <kovacs.zoltan@smartfront.hu>
 | 
			
		||||
#         Kovács Zoltán <kovacsz@marcusconsulting.hu>
 | 
			
		||||
# License: GNU/GPL v3+ (https://www.gnu.org/licenses/gpl-3.0.en.html)
 | 
			
		||||
# 2025-03-06 v1.1
 | 
			
		||||
# new: added the --noconf option which prevents reading and creating
 | 
			
		||||
#      the configuration file.
 | 
			
		||||
# 2023-06-18 v1.0
 | 
			
		||||
# new: forked from the "SMARTERP_skeleton" repository.
 | 
			
		||||
# 2021.02.12 v0.3
 | 
			
		||||
@@ -77,6 +80,7 @@ RETAIN_MONTHS=${RETAIN_MONTHS-"12"}
 | 
			
		||||
# Other initialisations (maybe overridden by configuration).
 | 
			
		||||
#
 | 
			
		||||
DOIT=""
 | 
			
		||||
NOCONF=""
 | 
			
		||||
 | 
			
		||||
# Messages (maybe overriden by configuration).
 | 
			
		||||
#
 | 
			
		||||
@@ -106,6 +110,7 @@ do
 | 
			
		||||
    case ${option} in
 | 
			
		||||
        "-" )
 | 
			
		||||
            if   [ "$OPTARG" = "doit" ]; then DOIT="yes"
 | 
			
		||||
            elif [ "$OPTARG" = "noconf" ]; then NOCONF="yes"
 | 
			
		||||
	    else echo "$MSG_BADOPT --$OPTARG" >&2; exit 1
 | 
			
		||||
            fi
 | 
			
		||||
        ;;
 | 
			
		||||
@@ -135,9 +140,10 @@ BACKUP_FOLDER=${BACKUP_FOLDER%/}
 | 
			
		||||
if [ -z "$BACKUP_FOLDER" -o ! -d "$BACKUP_FOLDER" -o ! -w "$BACKUP_FOLDER" ]
 | 
			
		||||
then echo -e "$MSG_BADFOLDER $BACKUP_FOLDER" >&2; exit 1; fi
 | 
			
		||||
 | 
			
		||||
# Gets the configuration (if any).
 | 
			
		||||
# Applies the configuration (if it exists and if it doesn't need to be ignored).
 | 
			
		||||
BACKUP_CONF="$BACKUP_FOLDER/.$("$BASENAME" "$0").conf"
 | 
			
		||||
if [ -r $BACKUP_CONF ]; then . "$BACKUP_CONF"
 | 
			
		||||
if [ "$NOCONF" = "yes" ]; then :
 | 
			
		||||
elif [ -r $BACKUP_CONF ]; then . "$BACKUP_CONF"
 | 
			
		||||
else
 | 
			
		||||
    # Warns about failure.
 | 
			
		||||
    echo -e "$MSG_NOCONF $BACKUP_CONF"
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user