diff --git a/openbis_all/source/bash/check-and-exit-if-new-sprint-server.sh b/openbis_all/source/bash/check-and-exit-if-new-sprint-server.sh
index 6b9debc5846f43829f7ab46e33a4d02921184068..400bfe6a589dfa0d213bbde1c4f8a56fc0d17723 100755
--- a/openbis_all/source/bash/check-and-exit-if-new-sprint-server.sh
+++ b/openbis_all/source/bash/check-and-exit-if-new-sprint-server.sh
@@ -1,37 +1,57 @@
 #! /bin/bash
 # 
 # This script checks whether openBIS AS server is a sprint server installed in the current week
-# or not. If yes exit (with exit code 0) is executed.
+# or not. If yes it exits with exit code 1.
 # 
-# usage: check-and-exit-if-new-sprint-server.sh <servers>
+# usage: check-and-exit-if-new-sprint-server.sh <servers> <version file>
 # 
 # where 
 # <servers> is the path to the directory containing the server folders 'openBIS-server' 
 #    and 'datastore_server',
+# <version file> is a file which will contain the time stamp of first installation of 
+#    a major version. If it doesn't exist it will be created.
 # 
-if [ $# -ne 1 ]; then
-    echo "Usage: check-and-exit-if-new-sprint-server.sh <servers>"
-    exit 1
-fi
+# 
+set -o nounset
+set -o errexit
+
+function getValue {
+    file="$1"
+    if [ -f "$file" ]; then
+        awk -F ' *= *' -v key=$2 '{map[$1] = $2} END {print map[key]}' "$file"
+    fi
+}
 
 SERVERS="$1"
+VERSION_FILE="$2"
 LOG_FILE=$SERVERS/openBIS-server/jetty/logs/jetty.out
 
 CURRENT_VERSION=UNKNOWN
 if [ -f $LOG_FILE ]; then
-    CURRENT_VERSION=`awk '/STATUS.CISDContextLoaderListener - Version/ {print $1" "$2" "$8" "$9}' $LOG_FILE | tail -1`
+    CURRENT_VERSION=`awk '/STATUS.CISDContextLoaderListener - Version/ {print $1" "$2" "$8" "$9}' $LOG_FILE | head -n 1`
+    CURRENT_VERSION_NAME=`echo $CURRENT_VERSION|awk '{print $3}'`
+    if [ $CURRENT_VERSION_NAME == "" ]; then
+        echo "Current version of openBIS Application Server not known"
+        exit
+    fi
     echo "Current openBIS Application Server: $CURRENT_VERSION"
-    if [ "SNAPSHOT" != "`echo $CURRENT_VERSION|awk '{print $3}'`" ]; then
-        TIME_STAMP="`echo $CURRENT_VERSION|awk '{print $1, $2}'`"
-        WEEK=`date --date="$TIME_STAMP" "+%W"`
-        if [ $? -ne 0 ]; then
+    if [ "SNAPSHOT" != $CURRENT_VERSION_NAME ]; then
+        CURRENT_MAJOR_VERSION=${CURRENT_VERSION_NAME%.*}
+        echo "Current major version: $CURRENT_MAJOR_VERSION"
+        TIME_STAMP=`getValue "$VERSION_FILE" $CURRENT_MAJOR_VERSION`
+        if [ -z "$TIME_STAMP" ]; then 
+            TIME_STAMP="`echo $CURRENT_VERSION|awk '{print $1, $2}'`"
+            echo "$CURRENT_MAJOR_VERSION = $TIME_STAMP" >> "$VERSION_FILE"
+        fi
+        echo "Time stamp of major version: $TIME_STAMP"
+        if ! WEEK=`date --date="$TIME_STAMP" "+%W"`; then
             # Mac OSX has a different flavor of date command
             WEEK=`date -j -f "%Y-%m-%d %H:%M:%S" "$TIME_STAMP" "+%W"`
         fi
         CURRENT_WEEK=`date "+%W"`
         if [ "$WEEK" = "$CURRENT_WEEK" ]; then
             echo "Sprint server not replaced until next week."
-            exit
+            exit 1
         fi
     fi 
 fi
diff --git a/openbis_all/source/bash/create-config-snapshot.sh b/openbis_all/source/bash/create-config-snapshot.sh
index 6b4327fc0dae5a39b8232ffeecb0b5a1bfcce880..3bcdfbd58a963a544f295726e15ec9014ea58630 100755
--- a/openbis_all/source/bash/create-config-snapshot.sh
+++ b/openbis_all/source/bash/create-config-snapshot.sh
@@ -11,6 +11,9 @@
 #    Empty lines and lines starting with '#' are ignored
 # 
 # 
+set -o nounset
+set -o errexit
+
 if [ $# -lt 3 ]; then
     echo "Usage: create-config-snapshot.sh <servers> <snapshot repository> <config file list 1> ... <config file list n>"
     exit 1
diff --git a/openbis_all/source/bash/create-generic-snapshot.sh b/openbis_all/source/bash/create-generic-snapshot.sh
index a3456fb3981d112803abf26a0599f994747f4b14..c897767fe470790216a7b865814ec1a43bac67c0 100644
--- a/openbis_all/source/bash/create-generic-snapshot.sh
+++ b/openbis_all/source/bash/create-generic-snapshot.sh
@@ -10,6 +10,8 @@
 # Dependencies:
 # - create-snapshot.sh
 #
+set -o nounset
+set -o errexit
 
 BIN_DIR=`dirname "$0"`
 REPOSITORY=~/snapshots
diff --git a/openbis_all/source/bash/create-snapshot.sh b/openbis_all/source/bash/create-snapshot.sh
index 5797e4cbb129cab38a3c4916c982c47d358d8d3a..931429f0435da3e00a56bfba13237172a7067843 100755
--- a/openbis_all/source/bash/create-snapshot.sh
+++ b/openbis_all/source/bash/create-snapshot.sh
@@ -20,6 +20,9 @@
 # - Store dump doesn't contain archived data sets and data sets in a share which is a symbolic link. 
 # - The configuration file of the argument is stored in the snapshot. It is used for restoring.
 # 
+set -o nounset
+set -o errexit
+
 function getValue {
     file=$1
     key=$2
@@ -91,8 +94,7 @@ for path in "$STORE"/*; do
         else
             echo "Start dumping share $file_name."
             parent_folder=${path:0:$index_of_last_slash}
-            tar -rf "$SNAPSHOT/store.tar" -C "$parent_folder" $file_name 
-            if [ $? -ne 0 ]; then
+            if ! tar -rf "$SNAPSHOT/store.tar" -C "$parent_folder" $file_name; then
                 echo "Error while dumping share $file_name. Snapshot creation aborted."
                 exit 1
             fi
@@ -103,23 +105,20 @@ done
 echo "Dump of store $STORE has been successfully created."
 ############## dump databases ##############
 for db in $DATABASES; do
-    pg_dump -U postgres -O $db > "$SNAPSHOT/$db.sql"
-    if [ $? -ne 0 ]; then
+    if ! pg_dump -U postgres -O $db > "$SNAPSHOT/$db.sql"; then
         echo "Error dumping database '$db'. Snapshot creation aborted."
         exit 1
     fi
     echo "Database '$db' has been successfully dumped."
 done
 ############## dump index ##############
-tar -cf "$SNAPSHOT/index.tar" -C "$INDEX" .
-if [ $? -ne 0 ]; then
+if ! tar -cf "$SNAPSHOT/index.tar" -C "$INDEX" .; then
     echo "Error creating index dump. Snapshot creation aborted."
     exit 1
 fi
 echo "Dump of index $INDEX has been successfully created."
 ############## packaging ##############
-tar -zcf "$SNAPSHOT.tgz" -C "$REPOSITORY" "$SNAPSHOT_FOLDER_NAME" 
-if [ $? -ne 0 ]; then
+if ! tar -zcf "$SNAPSHOT.tgz" -C "$REPOSITORY" "$SNAPSHOT_FOLDER_NAME"; then
     echo "Error packaging snapshot $SNAPSHOT."
     exit 1
 fi
diff --git a/openbis_all/source/bash/create-sprint-screening-snapshot.sh b/openbis_all/source/bash/create-sprint-screening-snapshot.sh
index 6c31a43293186464f1b460bdda07170035f8d0e6..c4c7b09472f32497bdb7beb00a797341b4e769b7 100644
--- a/openbis_all/source/bash/create-sprint-screening-snapshot.sh
+++ b/openbis_all/source/bash/create-sprint-screening-snapshot.sh
@@ -10,6 +10,8 @@
 # Dependencies:
 # - create-snapshot.sh
 #
+set -o nounset
+set -o errexit
 
 BIN_DIR=`dirname "$0"`
 REPOSITORY=~/screening/snapshots
diff --git a/openbis_all/source/bash/fetch-ci-artifacts.sh b/openbis_all/source/bash/fetch-ci-artifacts.sh
index 83b75c25de823c67cc4abafda38b6cf73e63dbe1..aec356347e1fc97498815cb2d5f1fe074fa4315d 100755
--- a/openbis_all/source/bash/fetch-ci-artifacts.sh
+++ b/openbis_all/source/bash/fetch-ci-artifacts.sh
@@ -10,6 +10,9 @@
 # If the p option is specified only artifact file names matching the regular expression will 
 # be loaded from Hudson. 
 #
+set -o nounset
+set -o errexit
+
 CI_HOST=cisd-ci.ethz.ch:8090
 
 if [ $# -lt 1 ]; then
diff --git a/openbis_all/source/bash/fetch-generic-sprint-server-artifacts.sh b/openbis_all/source/bash/fetch-generic-sprint-server-artifacts.sh
index 49cd3a24b9aa46ba09ce3b95e42861ad8a97b5ae..60487b0d093ebeb68f68ad72e948d1b8b1fd3d61 100755
--- a/openbis_all/source/bash/fetch-generic-sprint-server-artifacts.sh
+++ b/openbis_all/source/bash/fetch-generic-sprint-server-artifacts.sh
@@ -5,6 +5,8 @@
 # Dependencies:
 # - fetch-ci-artifacts.sh
 #
+set -o nounset
+set -o errexit
 
 BIN_DIR=`dirname "$0"`
 SCRIPT="$BIN_DIR/fetch-ci-artifacts.sh"
diff --git a/openbis_all/source/bash/fetch-screening-sprint-server-artifacts.sh b/openbis_all/source/bash/fetch-screening-sprint-server-artifacts.sh
index cf6d56042a2457def7a334d2f89732d2705e10ad..fabb471127b6e5b231bf46f5e4358987fbfb305e 100755
--- a/openbis_all/source/bash/fetch-screening-sprint-server-artifacts.sh
+++ b/openbis_all/source/bash/fetch-screening-sprint-server-artifacts.sh
@@ -5,6 +5,8 @@
 # Dependencies:
 # - fetch-ci-artifacts.sh
 #
+set -o nounset
+set -o errexit
 
 BIN_DIR=`dirname "$0"`
 SCRIPT="$BIN_DIR/fetch-ci-artifacts.sh"
diff --git a/openbis_all/source/bash/install-servers.sh b/openbis_all/source/bash/install-servers.sh
index fe8294fee2d9b4c24dbf7cb1ae36147b3acef9f8..38c019cc861d4625631a2079b57ec48cb5d5f9cd 100755
--- a/openbis_all/source/bash/install-servers.sh
+++ b/openbis_all/source/bash/install-servers.sh
@@ -12,8 +12,10 @@
 # - restore-config-snapshot.sh
 # - install.sh of the openBIS AS distribution
 # 
+set -o nounset
+set -o errexit
 
-if [ $# -le 4 ]; then
+if [ $# -lt 4 ]; then
     echo "Usage: install-servers.sh <servers> <config snapshot repository> <builds fetching script> <config file list 1> ... <config file list n>"
     exit 1
 fi
diff --git a/openbis_all/source/bash/nightly-upgrade-generic-openbis.sh b/openbis_all/source/bash/nightly-upgrade-generic-openbis.sh
index 462789d6d1a75c8888954a979f258f5dd81471e7..4641de8811c64e22b6caac04bdb6fe78f0bfb051 100644
--- a/openbis_all/source/bash/nightly-upgrade-generic-openbis.sh
+++ b/openbis_all/source/bash/nightly-upgrade-generic-openbis.sh
@@ -17,13 +17,16 @@
 # - servers-startup-from-latest-snapshot.sh
 # - config-files.txt
 #
+set -o nounset
+set -o errexit
 
 BIN_DIR=`dirname "$0"`
 SERVERS=sprint
+VERSION_FILE=sprint-versions.txt
 
 echo ":::::::::::::::::::: Nightly Upgrade Generic openBIS Servers [`date`] :::::::::::::::::::::"
 
-"$BIN_DIR/check-and-exit-if-new-sprint-server.sh" "$SERVERS"
+if ! "$BIN_DIR/check-and-exit-if-new-sprint-server.sh" "$SERVERS" "$VERSION_FILE"; then exit; fi
 
 ##################################################
 #
diff --git a/openbis_all/source/bash/nightly-upgrade-screening-openbis.sh b/openbis_all/source/bash/nightly-upgrade-screening-openbis.sh
index 077191939915c1b57d10699b5b1d460d5aba50ae..86d015b22e31e7a7c117cfdc4535c12662e0ebc5 100644
--- a/openbis_all/source/bash/nightly-upgrade-screening-openbis.sh
+++ b/openbis_all/source/bash/nightly-upgrade-screening-openbis.sh
@@ -18,14 +18,18 @@
 # - config-files.txt
 # - config-files-screening.txt
 #
+set -o nounset
+set -o errexit
 
 BIN_DIR=`dirname "$0"`
 SERVERS=screening/servers
+VERSION_FILE=screening/sprint-versions.txt
 
 echo ":::::::::::::::::::: Nightly Upgrade Screening openBIS Servers [`date`] :::::::::::::::::::::"
 
-"$BIN_DIR/check-and-exit-if-new-sprint-server.sh" "$SERVERS"
-
+if ! "$BIN_DIR/check-and-exit-if-new-sprint-server.sh" "$SERVERS" "$VERSION_FILE"; then exit; fi
+echo we exit
+exit
 ##################################################
 #
 # Upgrade servers and restart them
diff --git a/openbis_all/source/bash/servers-shutdown.sh b/openbis_all/source/bash/servers-shutdown.sh
index e1fec77600e3a6fd22ffc2b647e11f053b59f881..baba4fc49c60ebb2d97115d7503997ce7dc30cfe 100755
--- a/openbis_all/source/bash/servers-shutdown.sh
+++ b/openbis_all/source/bash/servers-shutdown.sh
@@ -10,6 +10,8 @@
 #   <servers folder>/datastore_server
 #   If one of these folders do not exists shutdown is aborted.
 #
+set -o nounset
+set -o errexit
 
 if [ $# -ne 1 ]; then
     echo "Usage: servers-shutdown.sh <servers folder>"
diff --git a/openbis_all/source/bash/servers-startup-from-latest-snapshot.sh b/openbis_all/source/bash/servers-startup-from-latest-snapshot.sh
index 0e3c3ecfcbf43bf2e0d89af90ee232126ecfa757..7378fca6e0060c910359ed0eb733714173a74f6c 100755
--- a/openbis_all/source/bash/servers-startup-from-latest-snapshot.sh
+++ b/openbis_all/source/bash/servers-startup-from-latest-snapshot.sh
@@ -14,6 +14,8 @@
 # Dependencies:
 # - servers-startup-from-snapshot.sh
 #
+set -o nounset
+set -o errexit
 
 if [ $# -ne 2 ]; then
     echo "Usage: servers-startup-from-latest-snapshot.sh <servers> <snapshot repository>"
diff --git a/openbis_all/source/bash/servers-startup-from-snapshot.sh b/openbis_all/source/bash/servers-startup-from-snapshot.sh
index 9a8c3b0ad341cecf5cd931c0c595a40fee8e00b5..8dd6a9abad84cb6314e5295480d47458b7f62701 100755
--- a/openbis_all/source/bash/servers-startup-from-snapshot.sh
+++ b/openbis_all/source/bash/servers-startup-from-snapshot.sh
@@ -17,6 +17,8 @@
 # - servers-shutdown.sh
 # - servers-startup.sh
 #
+set -o nounset
+set -o errexit
 
 function getValue {
     file=$1
diff --git a/openbis_all/source/bash/servers-startup.sh b/openbis_all/source/bash/servers-startup.sh
index 5333ef1c56b4d94efeedebdf7d42ce183597642a..1692f2b93894dd13d463374f7ec18eb6bef2b5ac 100755
--- a/openbis_all/source/bash/servers-startup.sh
+++ b/openbis_all/source/bash/servers-startup.sh
@@ -10,6 +10,8 @@
 #   <servers folder>/datastore_server
 #   If one of these folders do not exists there will be no start up.
 #
+set -o nounset
+set -o errexit
 
 if [ $# -ne 1 ]; then
     echo "Usage: servers-startup.sh <servers folder>"