Some changes on script output.
This commit is contained in:
parent
3f6850f356
commit
8eee0f3f3e
@ -261,8 +261,10 @@ if [[ "$POSTFIX_DB_TYPE" = "pgsql" ]] ; then
|
||||
su - postgres -c "pg_dump -c $POSTFIX_DB_NAME" > ${LOG_DIR}/dump-${POSTFIX_DB_NAME}.${date}.sql 2> $log_file_backup_database_error
|
||||
if [[ $? -eq 0 ]]; then
|
||||
echo_ok
|
||||
echo "[ ok ]: Backup Postfix Database to ${LOG_DIR}/dump-${POSTFIX_DB_NAME}.${date}.sql." >> $log_file
|
||||
else
|
||||
echo_failed
|
||||
echo "[failed ]: Backup Postfix Database failed ;" >> $log_file
|
||||
fatal "$(cat "$log_file_backup_database_error")"
|
||||
fi
|
||||
|
||||
@ -271,8 +273,10 @@ elif [[ "$POSTFIX_DB_TYPE" = "mysql" ]]; then
|
||||
mysqldump $MYSQL_CREDENTIALS --opt "$POSTFIX_DB_NAME" > ${LOG_DIR}/dump-${POSTFIX_DB_NAME}.${date}.sql 2> $log_file_backup_database_error
|
||||
if [[ $? -eq 0 ]]; then
|
||||
echo_ok
|
||||
echo "[ ok ]: Backup Postfix Database to ${LOG_DIR}/dump-${POSTFIX_DB_NAME}.${date}.sql." >> $log_file
|
||||
else
|
||||
echo_failed
|
||||
echo "[failed ]: Backup Postfix Database failed ;" >> $log_file
|
||||
fatal "$(cat "$log_file_backup_database_error")"
|
||||
fi
|
||||
else
|
||||
@ -336,6 +340,45 @@ fi
|
||||
echo -e "\n \033[1mAdjust configuration of Roundcube's password plugin\033[m\n"
|
||||
|
||||
|
||||
_failed=false
|
||||
_config_file="${DOCROOT_ROUNDCUBE}/plugins/password/config.inc.php"
|
||||
|
||||
echononl " Backup configuration file '$(basename "$_config_file")' from Roundcube's password plugin"
|
||||
if [[ -f "$_config_file" ]]; then
|
||||
|
||||
echo "" >> $log_file
|
||||
echo "" >> $log_file
|
||||
echo "# ---" >> $log_file
|
||||
echo "# - Backup configuration file '$(basename "$_config_file")' Roundcube's password plugin" >> $log_file
|
||||
echo "# ---" >> $log_file
|
||||
echo "" >> $log_file
|
||||
|
||||
cp -a "$_config_file" "${_config_file}.BAK.${date}" > $err_msg 2>&1
|
||||
if [[ $? -eq 0 ]] ; then
|
||||
echo_ok
|
||||
echo "[ ok ]: File '${_config_file}.BAK.${date}' saved." >> $log_file
|
||||
else
|
||||
echo_failed
|
||||
echo "[ failed ]: Backup configuration file '$(basename "$_config_file")'!" >> $log_file
|
||||
error "$(cat "$err_msg")"
|
||||
fi
|
||||
else
|
||||
echo_failed
|
||||
fatal "Configuration file for Postfixadmin not found!"
|
||||
fi
|
||||
|
||||
|
||||
# - Adjust configuration of roundcube password plugin
|
||||
# -
|
||||
# - $config['password_algorithm'] = 'dovecot';
|
||||
# - $config['password_algorithm_prefix'] = '{${DOVECOT_ENC_METHOD_NEW}}';
|
||||
# - $config['password_dovecotpw'] = '/usr/local/dovecot/bin/doveadm pw';
|
||||
# - $config['password_dovecotpw_method'] = $DOVECOT_ENC_METHOD_NEW;
|
||||
# - $config['password_dovecotpw_with_method'] = true;
|
||||
# -
|
||||
echononl " Adjust configuration of roundcube password plugin.."
|
||||
if [[ -f "${_config_file}" ]]; then
|
||||
|
||||
echo "" >> $log_file
|
||||
echo "" >> $log_file
|
||||
echo "# ---" >> $log_file
|
||||
@ -350,34 +393,6 @@ echo "# -" >> $log_file
|
||||
echo "# ---" >> $log_file
|
||||
echo "" >> $log_file
|
||||
|
||||
# - Adjust configuration of roundcube password plugin
|
||||
# -
|
||||
# - $config['password_algorithm'] = 'dovecot';
|
||||
# - $config['password_algorithm_prefix'] = '{${DOVECOT_ENC_METHOD_NEW}}';
|
||||
# - $config['password_dovecotpw'] = '/usr/local/dovecot/bin/doveadm pw';
|
||||
# - $config['password_dovecotpw_method'] = $DOVECOT_ENC_METHOD_NEW;
|
||||
# - $config['password_dovecotpw_with_method'] = true;
|
||||
# -
|
||||
_failed=false
|
||||
_config_file="${DOCROOT_ROUNDCUBE}/plugins/password/config.inc.php"
|
||||
|
||||
echononl " Backup configuration file '$(basename "$_config_file")' from Roundcube's password plugin"
|
||||
if [[ -f "$_config_file" ]]; then
|
||||
cp -a "$_config_file" "${_config_file}.BAK.${date}" > $err_msg 2>&1
|
||||
if [[ $? -eq 0 ]] ; then
|
||||
echo_ok
|
||||
else
|
||||
echo_failed
|
||||
error "$(cat "$err_msg")"
|
||||
fi
|
||||
else
|
||||
echo_failed
|
||||
fatal "Configuration file for Postfixadmin not found!"
|
||||
fi
|
||||
|
||||
echononl " Adjust configuration of roundcube password plugin.."
|
||||
if [[ -f "${_config_file}" ]]; then
|
||||
|
||||
_key="password_algorithm"
|
||||
_val="'dovecot'"
|
||||
if ! grep -q -E "^\s*\\\$config\['$_key'\]\s*=\s*$_val" "${_config_file}" 2> /dev/null ; then
|
||||
@ -385,6 +400,9 @@ if [[ -f "${_config_file}" ]]; then
|
||||
${_config_file} >> $log_file 2>&1
|
||||
if [[ $? -ne 0 ]] ; then
|
||||
_failed=true
|
||||
echo "[failed ]: Setting \$config['$_key'] = $_val ;" >> $log_file
|
||||
else
|
||||
echo "[ ok ]: Setting \$config['$_key'] = $_val ;" >> $log_file
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -395,6 +413,9 @@ if [[ -f "${_config_file}" ]]; then
|
||||
${_config_file} >> $log_file 2>&1
|
||||
if [[ $? -ne 0 ]] ; then
|
||||
_failed=true
|
||||
echo "[failed ]: Setting \$config['$_key'] = $_val ;" >> $log_file
|
||||
else
|
||||
echo "[ ok ]: Setting \$config['$_key'] = $_val ;" >> $log_file
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -405,6 +426,9 @@ if [[ -f "${_config_file}" ]]; then
|
||||
${_config_file} >> $log_file 2>&1
|
||||
if [[ $? -ne 0 ]] ; then
|
||||
_failed=true
|
||||
echo "[failed ]: Setting \$config['$_key'] = $_val ;" >> $log_file
|
||||
else
|
||||
echo "[ ok ]: Setting \$config['$_key'] = $_val ;" >> $log_file
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -415,6 +439,9 @@ if [[ -f "${_config_file}" ]]; then
|
||||
${_config_file} >> $log_file 2>&1
|
||||
if [[ $? -ne 0 ]] ; then
|
||||
_failed=true
|
||||
echo "[failed ]: Setting \$config['$_key'] = $_val ;" >> $log_file
|
||||
else
|
||||
echo "[ ok ]: Setting \$config['$_key'] = $_val ;" >> $log_file
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -425,6 +452,9 @@ if [[ -f "${_config_file}" ]]; then
|
||||
${_config_file} >> $log_file 2>&1
|
||||
if [[ $? -ne 0 ]] ; then
|
||||
_failed=true
|
||||
echo "[failed ]: Setting \$config['$_key'] = $_val ;" >> $log_file
|
||||
else
|
||||
echo "[ ok ]: Setting \$config['$_key'] = $_val ;" >> $log_file
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -443,6 +473,7 @@ if [[ -f "${_config_file}.BAK.${date}" ]]; then
|
||||
if diff "${_config_file}" "${_config_file}.BAK.${date}" > /dev/null 2>&1 ; then
|
||||
info "${_config_file} has not changed.\n Removing previos created backup.."
|
||||
rm "${_config_file}.BAK.${date}"
|
||||
echo "[ ok ]: ${_config_file} has not changed. Removing previos created backup.." >> $log_file
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -534,8 +565,10 @@ if [[ -f "$_config_file" ]]; then
|
||||
cp -a "$_config_file" "${_config_file}.BAK.${date}" > $err_msg 2>&1
|
||||
if [[ $? -eq 0 ]] ; then
|
||||
echo_ok
|
||||
echo "[ ok ]: File '${_config_file}.BAK.${date}' saved." >> $log_file
|
||||
else
|
||||
echo_failed
|
||||
echo "[ failed ]: Backup configuration file '$(basename "$_config_file")'!" >> $log_file
|
||||
error "$(cat "$err_msg")"
|
||||
fi
|
||||
else
|
||||
@ -553,6 +586,9 @@ if [[ -f "$_config_file" ]]; then
|
||||
${_config_file} >> $log_file 2>&1
|
||||
if [[ $? -ne 0 ]] ; then
|
||||
_failed=true
|
||||
echo "[failed ]: Setting \$CONF['$_key'] = $_val ;" >> $log_file
|
||||
else
|
||||
echo "[ ok ]: Setting \$CONF['$_key'] = $_val ;" >> $log_file
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -564,6 +600,9 @@ if [[ -f "$_config_file" ]]; then
|
||||
"$_config_file" >> $log_file 2>&1
|
||||
if [[ $? -ne 0 ]] ; then
|
||||
_failed=true
|
||||
echo "[failed ]: Setting \$CONF['$_key'] = $_val ;" >> $log_file
|
||||
else
|
||||
echo "[ ok ]: Setting \$CONF['$_key'] = $_val ;" >> $log_file
|
||||
fi
|
||||
fi
|
||||
else
|
||||
@ -596,6 +635,7 @@ if [[ -f "${_config_file}.BAK.${date}" ]]; then
|
||||
if diff "${_config_file}" "${_config_file}.BAK.${date}" > /dev/null 2>&1 ; then
|
||||
info "${_config_file} has not changed.\n Removing previos created backup.."
|
||||
rm "${_config_file}.BAK.${date}"
|
||||
echo "[ ok ]: ${_config_file} has not changed. Removing previos created backup.." >> $log_file
|
||||
fi
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user