diff --git a/org.adempiere.server-feature/utils.unix/RUN_MonitoredSyncDB.sh b/org.adempiere.server-feature/utils.unix/RUN_MonitoredSyncDB.sh index 80aed34f68..b83277081b 100755 --- a/org.adempiere.server-feature/utils.unix/RUN_MonitoredSyncDB.sh +++ b/org.adempiere.server-feature/utils.unix/RUN_MonitoredSyncDB.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # Author Carlos Ruiz if [ $IDEMPIERE_HOME ]; then @@ -7,4 +7,4 @@ fi . ./myEnvironment.sh Server echo Synchronize iDempiere Database - $IDEMPIERE_HOME \($ADEMPIERE_DB_NAME\) -sh $ADEMPIERE_DB_PATH/MonitoredSyncDB.sh "$ADEMPIERE_DB_USER" "$ADEMPIERE_DB_PASSWORD" "$ADEMPIERE_DB_PATH" $* +bash $ADEMPIERE_DB_PATH/MonitoredSyncDB.sh "$ADEMPIERE_DB_USER" "$ADEMPIERE_DB_PASSWORD" "$ADEMPIERE_DB_PATH" $* diff --git a/org.adempiere.server-feature/utils.unix/oracle/MonitoredSyncDB.sh b/org.adempiere.server-feature/utils.unix/oracle/MonitoredSyncDB.sh index 96635a2b01..eadde68131 100755 --- a/org.adempiere.server-feature/utils.unix/oracle/MonitoredSyncDB.sh +++ b/org.adempiere.server-feature/utils.unix/oracle/MonitoredSyncDB.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # # Author: Carlos Ruiz - globalqss # Script to synchronize the database with latest migration scripts allowing a remote monitored way diff --git a/org.adempiere.server-feature/utils.unix/postgresql/MonitoredSyncDB.sh b/org.adempiere.server-feature/utils.unix/postgresql/MonitoredSyncDB.sh index 33d3b9566a..73a628ee34 100755 --- a/org.adempiere.server-feature/utils.unix/postgresql/MonitoredSyncDB.sh +++ b/org.adempiere.server-feature/utils.unix/postgresql/MonitoredSyncDB.sh @@ -28,6 +28,17 @@ # 5. All the above steps are intended to be executed initially in a test or stage environment # When executed again on a clean environment, or applied in production, the script automatically applies the fixes and continue # +# WARNING: +# Please note this script depends on the language of the postgresql installation +# it searches for the strings: +# ERROR: -> english, spanish +# FATAL: -> english, spanish +# FEHLER: -> german +# ERRO: -> portuguese +# to support other languages, you need to edit the variable ERROR_STRINGS below +# a previous version of the script used the command SET lc_messages TO 'C'; +# but there are environments that doesn't support setting that variable, so better to be on the safe side +# echo Synchronize iDempiere Database @@ -55,10 +66,9 @@ export PGPASSWORD TMPFOLDER=/tmp ADEMPIERE_DB_USER=$1 ADEMPIERE_DB_PATH=$3 -CMDLANG="SET lc_messages TO 'C';" CMD="psql -b -h $ADEMPIERE_DB_SERVER -p $ADEMPIERE_DB_PORT -d $ADEMPIERE_DB_NAME -U $ADEMPIERE_DB_USER" SILENTCMD="$CMD -q -t" -ERROR_STRINGS="^(ERROR:|FATAL:)" +ERROR_STRINGS="^(ERROR:|FEHLER:|FATAL:|ERRO:)" DIR_POST=$IDEMPIERE_HOME/migration if [ "x$4" = "x" ] then @@ -82,7 +92,7 @@ apply_script() OUTFILE="$2" FILE="$3" echo "Applying $SCRIPT" - ( printf '%s' "$CMDLANG" ; cat "$SCRIPT" ) | $CMD > "$OUTFILE" 2>&1 + cat "$SCRIPT" | $CMD > "$OUTFILE" 2>&1 APPLIED=Y if grep -E "$ERROR_STRINGS" "$OUTFILE" > /dev/null 2>&1 then @@ -273,7 +283,7 @@ then do OUTFILE=$TMPFOLDER/SyncDB_out_$$/$(basename "$FILE" .sql).out echo "Applying $FILE" - ( printf '%s' "$CMDLANG" ; cat "$FILE" ) | $CMD > "$OUTFILE" 2>&1 + cat "$FILE" | $CMD > "$OUTFILE" 2>&1 if grep -E "$ERROR_STRINGS" "$OUTFILE" > /dev/null 2>&1 then echo "Found error in $SCRIPT"