benjobs 7 лет назад
Родитель
Сommit
c210ec82f0
4 измененных файлов с 130 добавлено и 96 удалено
  1. 16 16
      build.sh
  2. 75 47
      opencron-agent/src/conf/bin/opencron.sh
  3. 26 20
      opencron-server/startup.sh
  4. 13 13
      server.sh

+ 16 - 16
build.sh

@@ -8,7 +8,7 @@ GREEN_COLOR="\E[1;32m";
 YELLOW_COLOR="\E[1;33m";
 RES="\E[0m";
 
-echo -ne "${GREEN_COLOR}"
+printf "${GREEN_COLOR}\n"
 cat<<EOT
 
       --------------------------------------------
@@ -23,30 +23,30 @@ cat<<EOT
       --------------------------------------------
 
 EOT
-echo -ne "${RES}";
+printf "${RES}\n"
 
 echo_r () {
     # Color red: Error, Failed
     [ $# -ne 1 ] && return 1
-    echo -e "[${GREEN_COLOR}opencron${RES}] ${RED_COLOR}$1${RES}"
+    printf "[${BLUE_COLOR}opencron${RES}] ${RED_COLOR}$1${RES}\n"
 }
 
 echo_g () {
     # Color green: Success
     [ $# -ne 1 ] && return 1
-    echo -e "[${GREEN_COLOR}opencron${RES}] ${GREEN_COLOR}$1${RES}"
+    printf "[${BLUE_COLOR}opencron${RES}] ${GREEN_COLOR}$1${RES}\n"
 }
 
 echo_y () {
     # Color yellow: Warning
     [ $# -ne 1 ] && return 1
-    echo -e "[${GREEN_COLOR}opencron${RES}] ${YELLOW_COLOR}$1${RES}"
+    printf "[${BLUE_COLOR}opencron${RES}] ${YELLOW_COLOR}$1${RES}\n"
 }
 
 echo_w () {
     # Color yellow: White
     [ $# -ne 1 ] && return 1
-    echo -e "[${GREEN_COLOR}opencron${RES}] ${WHITE_COLOR}$1${RES}"
+    printf "[${BLUE_COLOR}opencron${RES}] ${WHITE_COLOR}$1${RES}\n"
 }
 
 
@@ -74,13 +74,13 @@ if [ -z "$JAVA_HOME" -a -z "$JRE_HOME" ]; then
     fi
   fi
   if [ -z "$JAVA_HOME" -a -z "$JRE_HOME" ]; then
-    echo "Neither the JAVA_HOME nor the JRE_HOME environment variable is defined"
-    echo "At least one of these environment variable is needed to run this program"
+    echo_r "Neither the JAVA_HOME nor the JRE_HOME environment variable is defined"
+    echo_r "At least one of these environment variable is needed to run this program"
     exit 1
   fi
 fi
 if [ -z "$JAVA_HOME" -a "$1" = "debug" ]; then
-  echo "JAVA_HOME should point to a JDK in order to run in debug mode."
+  echo_r "JAVA_HOME should point to a JDK in order to run in debug mode."
   exit 1
 fi
 if [ -z "$JRE_HOME" ]; then
@@ -91,16 +91,16 @@ fi
 if [ "$1" = "debug" ] ; then
   if [ "$os400" = "true" ]; then
     if [ ! -x "$JAVA_HOME"/bin/java -o ! -x "$JAVA_HOME"/bin/javac ]; then
-      echo "The JAVA_HOME environment variable is not defined correctly"
-      echo "This environment variable is needed to run this program"
-      echo "NB: JAVA_HOME should point to a JDK not a JRE"
+      echo_r "The JAVA_HOME environment variable is not defined correctly"
+      echo_r "This environment variable is needed to run this program"
+      echo_r "NB: JAVA_HOME should point to a JDK not a JRE"
       exit 1
     fi
   else
     if [ ! -x "$JAVA_HOME"/bin/java -o ! -x "$JAVA_HOME"/bin/jdb -o ! -x "$JAVA_HOME"/bin/javac ]; then
-      echo "The JAVA_HOME environment variable is not defined correctly"
-      echo "This environment variable is needed to run this program"
-      echo "NB: JAVA_HOME should point to a JDK not a JRE"
+      echo_r "The JAVA_HOME environment variable is not defined correctly"
+      echo_r "This environment variable is needed to run this program"
+      echo_r "NB: JAVA_HOME should point to a JDK not a JRE"
       exit 1
     fi
   fi
@@ -230,7 +230,7 @@ if [ ${retval} -eq 0 ] ; then
     [ ! -d "${DIST_HOME}" ] && mkdir ${DIST_HOME} || rm -rf  ${DIST_HOME}/* ;
     cp ${WORKDIR}/opencron-agent/target/opencron-agent-${OPENCRON_VERSION}.tar.gz ${DIST_HOME}
     cp ${WORKDIR}/opencron-server/target/opencron-server.war ${DIST_HOME}
-    echo -e "[${GREEN_COLOR}opencron${RES}] ${WHITE_COLOR}build opencron @ Version ${BLUE_COLOR}${OPENCRON_VERSION}${RES} successfully! please goto${RES} ${GREEN_COLOR}${DIST_HOME}${RES}"
+    printf "[${BLUE_COLOR}opencron${RES}] ${WHITE_COLOR}build opencron @Version ${OPENCRON_VERSION} successfully! please goto${RES} ${GREEN_COLOR}${DIST_HOME}${RES}\n"
     exit 0
 else
     echo_r "build opencron failed! please try again "

+ 75 - 47
opencron-agent/src/conf/bin/opencron.sh

@@ -40,10 +40,14 @@
 # -----------------------------------------------------------------------------
 
 #echo color
+WHITE_COLOR="\E[1;37m";
+RED_COLOR="\E[1;31m";
+BLUE_COLOR='\E[1;34m';
 GREEN_COLOR="\E[1;32m";
+YELLOW_COLOR="\E[1;33m";
 RES="\E[0m";
 
-echo -ne "${GREEN_COLOR}"
+printf "${GREEN_COLOR}\n"
 cat<<EOT
 
       --------------------------------------------
@@ -58,7 +62,31 @@ cat<<EOT
       --------------------------------------------
 
 EOT
-echo -ne "${RES}";
+printf "${RES}\n";
+
+echo_r () {
+    # Color red: Error, Failed
+    [ $# -ne 1 ] && return 1
+    printf "[${BLUE_COLOR}opencron${RES}] ${RED_COLOR}$1${RES}\n"
+}
+
+echo_g () {
+    # Color green: Success
+    [ $# -ne 1 ] && return 1
+    printf "[${BLUE_COLOR}opencron${RES}] ${GREEN_COLOR}$1${RES}\n"
+}
+
+echo_y () {
+    # Color yellow: Warning
+    [ $# -ne 1 ] && return 1
+    printf "[${BLUE_COLOR}opencron${RES}] ${YELLOW_COLOR}$1${RES}\n"
+}
+
+echo_w () {
+    # Color yellow: White
+    [ $# -ne 1 ] && return 1
+    printf "[${BLUE_COLOR}opencron${RES}] ${WHITE_COLOR}$1${RES}\n"
+}
 
 
 # OS specific support.  $var _must_ be set to either true or false.
@@ -116,13 +144,13 @@ fi
 # as this is used as the separator in the classpath and Java provides no
 # mechanism for escaping if the same character appears in the path.
 case $OPENCRON_HOME in
-  *:*) echo "Using OPENCRON_HOME:   $OPENCRON_HOME";
-       echo "Unable to start as OPENCRON_HOME contains a colon (:) character";
+  *:*) echo_w "Using OPENCRON_HOME:   $OPENCRON_HOME";
+       echo_w "Unable to start as OPENCRON_HOME contains a colon (:) character";
        exit 1;
 esac
 case $OPENCRON_BASE in
-  *:*) echo "Using OPENCRON_BASE:   $OPENCRON_BASE";
-       echo "Unable to start as OPENCRON_BASE contains a colon (:) character";
+  *:*) echo_w "Using OPENCRON_BASE:   $OPENCRON_BASE";
+       echo_w "Unable to start as OPENCRON_BASE contains a colon (:) character";
        exit 1;
 esac
 
@@ -187,7 +215,7 @@ OPENCRON_PIDDIR="/var/run";
 OPENCRON_PID="$OPENCRON_PIDDIR/opencron.pid";
 
 #opencron version
-OPENCRON_VERSION="1.2.0-RELEASE"
+OPENCRON_VERSION="1.1.0-RELEASE"
 
 # Add bootstrap.jar to classpath
 if [ ! -z "$CLASSPATH" ] ; then
@@ -215,17 +243,17 @@ fi
 
 # Bugzilla 37848: only output this if we have a TTY
 if [ $have_tty -eq 1 ]; then
-  echo "Using OPENCRON_BASE:   $OPENCRON_BASE"
-  echo "Using OPENCRON_HOME:   $OPENCRON_HOME"
-  echo "Using OPENCRON_TMPDIR: $OPENCRON_TMPDIR"
+  echo_w "Using OPENCRON_BASE:   $OPENCRON_BASE"
+  echo_w "Using OPENCRON_HOME:   $OPENCRON_HOME"
+  echo_w "Using OPENCRON_TMPDIR: $OPENCRON_TMPDIR"
   if [ "$1" = "debug" ] ; then
-    echo "Using JAVA_HOME:       $JAVA_HOME"
+    echo_w "Using JAVA_HOME:       $JAVA_HOME"
   else
-    echo "Using JRE_HOME:        $JRE_HOME"
+    echo_w "Using JRE_HOME:        $JRE_HOME"
   fi
-  echo "Using CLASSPATH:       $CLASSPATH"
+  echo_w "Using CLASSPATH:       $CLASSPATH"
   if [ ! -z "$OPENCRON_PID" ]; then
-    echo "Using OPENCRON_PID:    $OPENCRON_PID"
+    echo_w "Using OPENCRON_PID:    $OPENCRON_PID"
   fi
 fi
 
@@ -257,21 +285,21 @@ case "$1" in
 
         if [ -z "$OPENCRON_PORT" ];then
             OPENCRON_PORT=1577;
-            echo "opencron port not input,will be used port:1577"
+            echo_w "opencron port not input,will be used port:1577"
         elif [ $OPENCRON_PORT -lt 0 ] || [ $OPENCRON_PORT -gt 65535 ];then
-            echo "port error,muse be between 0 and 65535!"
+            echo_r "port error,muse be between 0 and 65535!"
         fi
 
         if [ -z "$OPENCRON_PASSWORD" ];then
             #.password file not exists
             if [ ! -f "$OPENCRON_BASE/.password" ];then
                   OPENCRON_PASSWORD="opencron";
-                  echo "opencron password not input,will be used password:opencron"
+                  echo_w "opencron password not input,will be used password:opencron"
             else
                 #.password file already exists but empty
                if [ x`cat "$OPENCRON_BASE/.password"` = x"" ];then
                   OPENCRON_PASSWORD="opencron";
-                  echo "opencron password not input,will be used password:opencron"
+                  echo_r "opencron password not input,will be used password:opencron"
                fi
             fi
         fi
@@ -279,36 +307,36 @@ case "$1" in
         if [ ! -z "$OPENCRON_PID" ]; then
            if [ -f "$OPENCRON_PID" ]; then
               if [ -s "$OPENCRON_PID" ]; then
-                echo "Existing PID file found during start."
+                echo_w "Existing PID file found during start."
                 if [ -r "$OPENCRON_PID" ]; then
                   PID=`cat "$OPENCRON_PID"`
                   ps -p $PID >/dev/null 2>&1
                   if [ $? -eq 0 ] ; then
-                    echo "opencron appears to still be running with PID $PID. Start aborted."
-                    echo "If the following process is not a opencron process, remove the PID file and try again:"
+                    echo_r "opencron appears to still be running with PID $PID. Start aborted."
+                    echo_r "If the following process is not a opencron process, remove the PID file and try again:"
                     ps -f -p $PID
                     exit 1
                   else
-                    echo "Removing/clearing stale PID file."
+                    echo_w "Removing/clearing stale PID file."
                     rm -f "$OPENCRON_PID" >/dev/null 2>&1
                     if [ $? != 0 ]; then
                       if [ -w "$OPENCRON_PID" ]; then
                         cat /dev/null > "$OPENCRON_PID"
                       else
-                        echo "Unable to remove or clear stale PID file. Start aborted."
+                        echo_r "Unable to remove or clear stale PID file. Start aborted."
                         exit 1
                       fi
                     fi
                   fi
                 else
-                  echo "Unable to read PID file. Start aborted."
+                  echo_r "Unable to read PID file. Start aborted."
                   exit 1
                 fi
               else
                 rm -f "$OPENCRON_PID" >/dev/null 2>&1
                 if [ $? != 0 ]; then
                   if [ ! -w "$OPENCRON_PID" ]; then
-                    echo "Unable to remove or write to empty PID file. Start aborted."
+                    echo_r "Unable to remove or write to empty PID file. Start aborted."
                     exit 1
                   fi
                 fi
@@ -332,7 +360,7 @@ case "$1" in
       if [ ! -z "$OPENCRON_PID" ]; then
         echo $! > "$OPENCRON_PID"
       fi
-      echo "opencron started."
+      echo_g "opencron started."
       exit $?
       ;;
 
@@ -362,14 +390,14 @@ case "$1" in
                 #kill..
                 kill -0 `cat "$OPENCRON_PID"` >/dev/null 2>&1
                 if [ $? -gt 0 ]; then
-                  echo "PID file found but no matching process was found. Stop aborted."
+                  echo_r "PID file found but no matching process was found. Stop aborted."
                   exit 1
                 fi
               else
-                echo "PID file is empty and has been ignored."
+                echo_r "PID file is empty and has been ignored."
               fi
             else
-              echo "\$OPENCRON_PID was set but the specified file does not exist. Is opencron running? Stop aborted."
+              echo_r "\$OPENCRON_PID was set but the specified file does not exist. Is opencron running? Stop aborted."
               exit 1
             fi
           fi
@@ -378,12 +406,12 @@ case "$1" in
             -classpath "\"$CLASSPATH\"" \
             -Dopencron.home="$OPENCRON_HOME" \
             -Dopencron.pid="$OPENCRON_PID" \
-            org.opencron.agent.Bootstrap stop
+            org.opencron.agent.AgentBootstrap stop
 
           # stop failed. Shutdown port disabled? Try a normal kill.
           if [ $? != 0 ]; then
             if [ ! -z "$OPENCRON_PID" ]; then
-              echo "The stop command failed. Attempting to signal the process to stop through OS signal."
+              echo_r "The stop command failed. Attempting to signal the process to stop through OS signal."
               kill -15 `cat "$OPENCRON_PID"` >/dev/null 2>&1
             fi
           fi
@@ -400,21 +428,21 @@ case "$1" in
                       # If opencron has stopped don't try and force a stop with an empty PID file
                       FORCE=0
                     else
-                      echo "The PID file could not be removed or cleared."
+                      echo_r "The PID file could not be removed or cleared."
                     fi
                   fi
-                  echo "opencron stopped."
+                  echo_r "opencron stopped."
                   break
                 fi
                 if [ $SLEEP -gt 0 ]; then
                   sleep 1
                 fi
                 if [ $SLEEP -eq 0 ]; then
-                  echo "opencron did not stop in time."
+                  echo_w "opencron did not stop in time."
                   if [ $FORCE -eq 0 ]; then
-                    echo "PID file was not removed."
+                    echo_w "PID file was not removed."
                   fi
-                  echo "To aid diagnostics a thread dump has been written to standard out."
+                  echo_w "To aid diagnostics a thread dump has been written to standard out."
                   kill -3 `cat "$OPENCRON_PID"`
                 fi
                 SLEEP=`expr $SLEEP - 1 `;
@@ -425,11 +453,11 @@ case "$1" in
           KILL_SLEEP_INTERVAL=5
           if [ $FORCE -eq 1 ]; then
             if [ -z "$OPENCRON_PID" ]; then
-              echo "Kill failed: \$OPENCRON_PID not set"
+              echo_w "Kill failed: \$OPENCRON_PID not set"
             else
               if [ -f "$OPENCRON_PID" ]; then
                 PID=`cat "$OPENCRON_PID"`
-                echo "Killing opencron with the PID: $PID"
+                echo_w "Killing opencron with the PID: $PID"
                 kill -9 $PID
                 while [ $KILL_SLEEP_INTERVAL -ge 0 ]; do
                     kill -0 `cat "$OPENCRON_PID"` >/dev/null 2>&1
@@ -439,10 +467,10 @@ case "$1" in
                             if [ -w "$OPENCRON_PID" ]; then
                                 cat /dev/null > "$OPENCRON_PID"
                             else
-                                echo "The PID file could not be removed."
+                                echo_r "The PID file could not be removed."
                             fi
                         fi
-                        echo "The opencron process has been killed."
+                        echo_w "The opencron process has been killed."
                         break
                     fi
                     if [ $KILL_SLEEP_INTERVAL -gt 0 ]; then
@@ -451,7 +479,7 @@ case "$1" in
                     KILL_SLEEP_INTERVAL=`expr $KILL_SLEEP_INTERVAL - 1 `
                 done
                 if [ $KILL_SLEEP_INTERVAL -lt 0 ]; then
-                    echo "opencron has not been killed completely yet. The process might be waiting on some system call or might be UNINTERRUPTIBLE."
+                    echo_r "opencron has not been killed completely yet. The process might be waiting on some system call or might be UNINTERRUPTIBLE."
                 fi
               fi
             fi
@@ -460,12 +488,12 @@ case "$1" in
       ;;
 
     *)
-      echo "Unknown command: $1"
-      echo "Usage: $PROGRAM ( commands ... )"
-      echo "commands:"
-      echo "  start             Start opencron"
-      echo "  stop              Stop opencron"
-      echo "                    are you running?"
+      echo_g "Unknown command: $1"
+      echo_g "Usage: $PROGRAM ( commands ... )"
+      echo_g "commands:"
+      echo_g "  start             Start opencron"
+      echo_g "  stop              Stop opencron"
+      echo_g "                    are you running?"
       exit 1
     ;;
     esac

+ 26 - 20
opencron-server/startup.sh

@@ -8,7 +8,7 @@ GREEN_COLOR="\E[1;32m";
 YELLOW_COLOR="\E[1;33m";
 RES="\E[0m";
 
-echo -ne "${GREEN_COLOR}"
+printf "${GREEN_COLOR}\n"
 cat<<EOT
 
       --------------------------------------------
@@ -23,30 +23,30 @@ cat<<EOT
       --------------------------------------------
 
 EOT
-echo -ne "${RES}";
+printf "${RES}\n";
 
 echo_r () {
     # Color red: Error, Failed
     [ $# -ne 1 ] && return 1
-    echo -e "[${GREEN_COLOR}opencron${RES}] ${RED_COLOR}$1${RES}"
+    printf "[${GREEN_COLOR}opencron${RES}] ${RED_COLOR}$1${RES}\n"
 }
 
 echo_g () {
     # Color green: Success
     [ $# -ne 1 ] && return 1
-    echo -e "[${GREEN_COLOR}opencron${RES}] ${GREEN_COLOR}$1${RES}"
+    printf "[${GREEN_COLOR}opencron${RES}] ${GREEN_COLOR}$1${RES}\n"
 }
 
 echo_y () {
     # Color yellow: Warning
     [ $# -ne 1 ] && return 1
-    echo -e "[${GREEN_COLOR}opencron${RES}] ${YELLOW_COLOR}$1${RES}"
+    printf "[${GREEN_COLOR}opencron${RES}] ${YELLOW_COLOR}$1${RES}\n"
 }
 
 echo_w () {
     # Color yellow: White
     [ $# -ne 1 ] && return 1
-    echo -e "[${GREEN_COLOR}opencron${RES}] ${WHITE_COLOR}$1${RES}"
+    printf "[${GREEN_COLOR}opencron${RES}] ${WHITE_COLOR}$1${RES}\n"
 }
 
 # Make sure prerequisite environment variables are set
@@ -73,8 +73,8 @@ if [ -z "$JAVA_HOME" -a -z "$JRE_HOME" ]; then
     fi
   fi
   if [ -z "$JAVA_HOME" -a -z "$JRE_HOME" ]; then
-    echo "Neither the JAVA_HOME nor the JRE_HOME environment variable is defined"
-    echo "At least one of these environment variable is needed to run this program"
+    echo_r "Neither the JAVA_HOME nor the JRE_HOME environment variable is defined"
+    echo_r "At least one of these environment variable is needed to run this program"
     exit 1
   fi
 fi
@@ -90,16 +90,16 @@ fi
 if [ "$1" = "debug" ] ; then
   if [ "$os400" = "true" ]; then
     if [ ! -x "$JAVA_HOME"/bin/java -o ! -x "$JAVA_HOME"/bin/javac ]; then
-      echo "The JAVA_HOME environment variable is not defined correctly"
-      echo "This environment variable is needed to run this program"
-      echo "NB: JAVA_HOME should point to a JDK not a JRE"
+      echo_r "The JAVA_HOME environment variable is not defined correctly"
+      echo_r "This environment variable is needed to run this program"
+      echo_r "NB: JAVA_HOME should point to a JDK not a JRE"
       exit 1
     fi
   else
     if [ ! -x "$JAVA_HOME"/bin/java -o ! -x "$JAVA_HOME"/bin/jdb -o ! -x "$JAVA_HOME"/bin/javac ]; then
-      echo "The JAVA_HOME environment variable is not defined correctly"
-      echo "This environment variable is needed to run this program"
-      echo "NB: JAVA_HOME should point to a JDK not a JRE"
+      echo_r "The JAVA_HOME environment variable is not defined correctly"
+      echo_r "This environment variable is needed to run this program"
+      echo_r "NB: JAVA_HOME should point to a JDK not a JRE"
       exit 1
     fi
   fi
@@ -129,6 +129,12 @@ if [ $? -ne 1 ];then
   exit 1;
 fi
 
+#check openjdk
+if [ "`${RUNJAVA} -version 2>&1 | head -1|grep "openjdk"|wc -l`"x == "1"x ]; then
+  echo_r "ERROR: please uninstall OpenJDK and install jdk first"
+  exit 1;
+fi
+
 # OS specific support.  $var _must_ be set to either true or false.
 cygwin=false
 darwin=false
@@ -161,21 +167,21 @@ APP_ARTIFACT=opencron-server
 
 LIB_PATH="$WORKDIR"/WEB-INF/lib
 
+LOG_PATH="$WORKDIR"/work/logs
+
 # Add jars to classpath
 if [ ! -z "$CLASSPATH" ] ; then
   CLASSPATH="$CLASSPATH":
 fi
 CLASSPATH="$CLASSPATH""$WORKDIR"/WEB-INF/classes
 
-for jar in $LIB_PATH/*
+for jar in ${LIB_PATH}/*
 do
   CLASSPATH="$CLASSPATH":"$jar"
 done
 
-LOG_PATH="$WORKDIR"/logs
-
-#start JettyServer....
-echo_g "[opencron] server Starting...."
+#start server....
+printf "[${BLUE_COLOR}opencron${RES}] ${WHITE_COLOR} server Starting.... ${RES}\n"
 
 eval "\"$RUNJAVA\"" \
         -classpath "\"$CLASSPATH\"" \
@@ -183,7 +189,7 @@ eval "\"$RUNJAVA\"" \
         org.opencron.server.bootstrap.Startup $1 \
         >/dev/null 2>&1 "&";
 
-echo_g "[opencron] please see log for more detail: $LOG_PATH/opencron.out "
+printf "[${BLUE_COLOR}opencron${RES}] ${WHITE_COLOR} please see log for more detail:${RES}${GREEN_COLOR} $LOG_PATH/opencron.out ${RES}\n"
 
 exit $?
 

+ 13 - 13
server.sh

@@ -11,25 +11,25 @@ RES="\E[0m";
 echo_r () {
     # Color red: Error, Failed
     [ $# -ne 1 ] && return 1
-    echo -e "[${GREEN_COLOR}opencron${RES}] ${RED_COLOR}$1${RES}"
+    printf "[${BLUE_COLOR}opencron${RES}] ${RED_COLOR}$1${RES}\n"
 }
 
 echo_g () {
     # Color green: Success
     [ $# -ne 1 ] && return 1
-    echo -e "[${GREEN_COLOR}opencron${RES}] ${GREEN_COLOR}$1${RES}"
+    printf "[${BLUE_COLOR}opencron${RES}] ${GREEN_COLOR}$1${RES}\n"
 }
 
 echo_y () {
     # Color yellow: Warning
     [ $# -ne 1 ] && return 1
-    echo -e "[${GREEN_COLOR}opencron${RES}] ${YELLOW_COLOR}$1${RES}"
+    printf "[${BLUE_COLOR}opencron${RES}] ${YELLOW_COLOR}$1${RES}\n"
 }
 
 echo_w () {
     # Color yellow: White
     [ $# -ne 1 ] && return 1
-    echo -e "[${GREEN_COLOR}opencron${RES}] ${WHITE_COLOR}$1${RES}"
+    printf "[${BLUE_COLOR}opencron${RES}] ${WHITE_COLOR}$1${RES}\n"
 }
 
 # Make sure prerequisite environment variables are set
@@ -56,13 +56,13 @@ if [ -z "$JAVA_HOME" -a -z "$JRE_HOME" ]; then
     fi
   fi
   if [ -z "$JAVA_HOME" -a -z "$JRE_HOME" ]; then
-    echo "Neither the JAVA_HOME nor the JRE_HOME environment variable is defined"
-    echo "At least one of these environment variable is needed to run this program"
+    echo_r "Neither the JAVA_HOME nor the JRE_HOME environment variable is defined"
+    echo_r "At least one of these environment variable is needed to run this program"
     exit 1
   fi
 fi
 if [ -z "$JAVA_HOME" -a "$1" = "debug" ]; then
-  echo "JAVA_HOME should point to a JDK in order to run in debug mode."
+  echo_r "JAVA_HOME should point to a JDK in order to run in debug mode."
   exit 1
 fi
 if [ -z "$JRE_HOME" ]; then
@@ -73,16 +73,16 @@ fi
 if [ "$1" = "debug" ] ; then
   if [ "$os400" = "true" ]; then
     if [ ! -x "$JAVA_HOME"/bin/java -o ! -x "$JAVA_HOME"/bin/javac ]; then
-      echo "The JAVA_HOME environment variable is not defined correctly"
-      echo "This environment variable is needed to run this program"
-      echo "NB: JAVA_HOME should point to a JDK not a JRE"
+      echo_r "The JAVA_HOME environment variable is not defined correctly"
+      echo_r "This environment variable is needed to run this program"
+      echo_r "NB: JAVA_HOME should point to a JDK not a JRE"
       exit 1
     fi
   else
     if [ ! -x "$JAVA_HOME"/bin/java -o ! -x "$JAVA_HOME"/bin/jdb -o ! -x "$JAVA_HOME"/bin/javac ]; then
-      echo "The JAVA_HOME environment variable is not defined correctly"
-      echo "This environment variable is needed to run this program"
-      echo "NB: JAVA_HOME should point to a JDK not a JRE"
+      echo_r "The JAVA_HOME environment variable is not defined correctly"
+      echo_r "This environment variable is needed to run this program"
+      echo_r "NB: JAVA_HOME should point to a JDK not a JRE"
       exit 1
     fi
   fi