changeset 113:885818d29012

docker (libervia_cont): replaced printf by eprintf for error messages
author Goffi <goffi@goffi.org>
date Mon, 29 Feb 2016 22:06:03 +0100
parents a573bddf8039
children 14b29b9e06bb
files docker/libervia_cont.sh
diffstat 1 files changed, 13 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/docker/libervia_cont.sh	Mon Feb 29 22:01:02 2016 +0100
+++ b/docker/libervia_cont.sh	Mon Feb 29 22:06:03 2016 +0100
@@ -144,7 +144,7 @@
             if [ $? -eq 0 ]; then
                 printf "\nDownload of latest $image finished\n\n"
             else
-                printf "\nError while downloading $image, please check your connection and logs\n"
+                eprintf "\nError while downloading $image, please check your connection and logs\n"
                 return 1
             fi
         fi
@@ -261,7 +261,7 @@
             if [ $? -eq 0 ]; then
                 printf "A data container already exists ($VOLUME_ALIAS), use \"docker ps -a\" to see it\n"
             else
-                printf "Error, please check data volume\nerror message: $docker_id\n"
+                eprintf "Error, please check data volume\nerror message: $docker_id\n"
                 exit 1
             fi
         fi
@@ -282,15 +282,15 @@
                 salut) OPTS="$DK_DETACH $DK_TERM $DK_VOLUME --name salut --link=prosody:prosody";;
                 sat) OPTS="$DK_DETACH $DK_TERM $DK_VOLUME -P $(public_ports_arg $CONT) --name sat --link=prosody:prosody";;
                 libervia) OPTS="$DK_DETACH $DK_TERM $DK_VOLUME --volumes-from sat $DK_TLS -P $(public_ports_arg $CONT) --name libervia --link=sat:sat";;
-                *) printf "Unkown container $CONT\n"; exit 1
+                *) eprintf "Unkown container $CONT\n"; exit 1
             esac
             printf "Launching $CONT... "
             docker_id=$(docker run $OPTS $SAT_CONT_DK_EXTRA $ACCOUNT/$CONT 2>&1)
             if [ $? -eq 0 ]; then
                 printf "OK ($docker_id)\n"
             else
-                printf "Error, please check container or ask help on XMPP MUC sat@chat.jabberfr.org\nerror message: $docker_id\n"
-                printf "Abandon\n"
+                eprintf "Error, please check container or ask help on XMPP MUC sat@chat.jabberfr.org\nerror message: $docker_id\n"
+                eprintf "Abandon\n"
                 exit 1
             fi
         done
@@ -307,9 +307,9 @@
         done;
         for CONT in $REVERSED; do
             printf "\nStopping container $CONT"
-            docker stop $CONT > /dev/null 2>&1  || printf "... Error while stopping $CONT\n"
+            docker stop $CONT > /dev/null 2>&1  || eprintf "... Error while stopping $CONT\n"
             printf "\rDeleting container $CONT"
-            docker rm -v $CONT > /dev/null 2>&1 || printf "... Error while removing $CONT\n"
+            docker rm -v $CONT > /dev/null 2>&1 || eprintf "... Error while removing $CONT\n"
         done
         printf "\n"
         ;;
@@ -344,14 +344,14 @@
             printf "\n*** updating $CONT ***\n"
             docker pull $ACCOUNT/$CONT:latest
             if [ $? -ne 0 ]; then
-                printf "\nError while updating $ACCOUNT/$CONT\n"
+                eprintf "\nError while updating $ACCOUNT/$CONT\n"
                 errors=1
             fi
         done
         if [ $errors -eq 0 ]; then
             printf "\n\nImages are up-to-date\n"
         else
-            printf "\n\nSome errors happened while updating images\n"
+            eprintf "\n\nSome errors happened while updating images\n"
             exit 1
         fi
         ;;
@@ -370,7 +370,7 @@
         if [ $? -eq 0 ]; then
             printf "\nBackup finished and available at ${SAT_CONT_BACKUP_DIR}${filename}\n"
         else
-            printf "\nBackup Error !\n"
+            eprintf "\nBackup Error !\n"
             exit 1
         fi
         ;;
@@ -381,7 +381,7 @@
         fi
         docker run --name $VOLUME_ALIAS $VOLUME_CONT > /dev/null 2>&1
         if [ $? -ne 0 ]; then
-            printf "Can't create $VOLUME_ALIAS container.\n\
+            eprintf "Can't create $VOLUME_ALIAS container.\n\
 If you have an existing one, please remove it with \"docker rm -v $VOLUME_ALIAS\" (/!\\ it will remove *ALL* your data)\n\n\
 Hint: you can also rename your current data container with \"docker rename $VOLUME_ALIAS new_container_name\"\n"
             exit 1
@@ -398,7 +398,7 @@
         if [ $? -eq 0 ]; then
             printf "\nRestore finished\n"
         else
-            printf "\nRestore Error !\n"
+            eprintf "\nRestore Error !\n"
             exit 1
         fi
         ;;
@@ -456,6 +456,6 @@
         fi
         docker stats $1 $CONTAINERS
         ;;
-    *) printf "Error: unknown command !"
+    *) eprintf "Error: unknown command !"
        exit 2
 esac