check_config() update

check_config() update
This commit is contained in:
Patrick Van der Veken 2015-08-28 08:55:05 +02:00
parent 0db8e3c51d
commit bc952e64c2

View File

@ -41,6 +41,7 @@
# @(#) 2015-08-26: added DO_SFTP_CHMOD configuration parameter to avoid
# @(#) setstat failures with sftp_file() when remote file
# @(#) permissions do not allow (VRF 1.2.1) [Patrick Van der Veken]
# @(#) 2015-08-28: check_config() update (VRF 1.2.2) [Patrick Van der Veken]
# -----------------------------------------------------------------------------
# DO NOT CHANGE THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING!
#******************************************************************************
@ -54,7 +55,7 @@
# or LOCAL_CONFIG_FILE instead
# define the V.R.F (version/release/fix)
MY_VRF="1.2.1"
MY_VRF="1.2.2"
# name of the global configuration file (script)
GLOBAL_CONFIG_FILE="manage_ssh.conf"
# name of the local configuration file (script)
@ -102,26 +103,26 @@ then
SSH_TRANSFER_USER="${LOGNAME}"
if [[ -z "${SSH_TRANSFER_USER}" ]]
then
print -u2 "ERROR: unable to set a value for SSH_TRANSFER_USER in $0"
print -u2 "ERROR: no value for the SSH_TRANSFER_USER setting in the configuration file"
exit 1
fi
fi
# LOCAL_DIR
if [[ -z "${LOCAL_DIR}" ]]
then
print -u2 "ERROR: you must define a value for the LOCAL_DIR setting in $0"
print -u2 "ERROR: no value for the LOCAL_DIR setting in the configuration file"
exit 1
fi
# REMOTE_DIR
if [[ -z "${REMOTE_DIR}" ]]
then
print -u2 "ERROR: you must define a value for the REMOTE_DIR setting in $0"
print -u2 "ERROR: no value for the REMOTE_DIR setting in the configuration file"
exit 1
fi
# DO_SFTP_CHMOD
if [[ -z "${DO_SFTP_CHMOD}" ]]
then
print -u2 "ERROR: you must define a value for the DO_SFTP_CHMOD setting in $0"
print -u2 "ERROR: no value for the DO_SFTP_CHMOD setting in the configuration file"
exit 1
fi
# SSH_UPDATE_USER
@ -130,20 +131,20 @@ then
SSH_UPDATE_USER="${LOGNAME}"
if [[ -z "${SSH_UPDATE_USER}" ]]
then
print -u2 "ERROR: unable to set a value for SSH_UPDATE_USER in $0"
print -u2 "ERROR: no value for SSH_UPDATE_USER setting in the configuration file"
exit 1
fi
fi
# MAX_BACKGROUND_PROCS
if [[ -z "${MAX_BACKGROUND_PROCS}" ]]
then
print -u2 "ERROR: you must define a value for the MAX_BACKGROUND_PROCS setting in $0"
print -u2 "ERROR: no value for the MAX_BACKGROUND_PROCS setting in the configuration file"
exit 1
fi
# BACKUP_DIR
if [[ -z "${BACKUP_DIR}" ]]
then
print -u2 "ERROR: you must define a value for the BACKUP_DIR setting in $0"
print -u2 "ERROR: no value for the BACKUP_DIR setting in the configuration file"
exit 1
fi
@ -695,7 +696,7 @@ SOURCE_FILE="${TRANSFER_FILE##*/}"
OLD_PWD=$(pwd) && cd ${TRANSFER_DIR}
# transfer, (possibly) chmod the file to/on the target server (keep STDERR)
if (( DO_SFTP_CHMOD ))
if (( DO_SFTP_CHMOD ))
then
sftp ${SFTP_ARGS} ${SSH_TRANSFER_USER}@${TRANSFER_HOST} >/dev/null <<EOT
cd ${REMOTE_DIR}