From baaf251c0074fdd6d743b27bc1d97637c8ca3e4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Wed, 24 Jul 2019 11:26:09 +0200 Subject: [PATCH] Exit script if some commands return error --- ceph/ceph.backup.deb.files.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ceph/ceph.backup.deb.files.sh b/ceph/ceph.backup.deb.files.sh index 66eaf71..e912f13 100755 --- a/ceph/ceph.backup.deb.files.sh +++ b/ceph/ceph.backup.deb.files.sh @@ -33,10 +33,10 @@ if [ "$(command -v ceph)" ]; then ## Download deb files of all ceph related packages installed on the system printf '%b\n' "Download deb files of all ceph related packages installed on the system." - apt download -- $(dpkg -l | awk -v pattern="${CEPH_DEB_PKG_PATTERN}" '$0~pattern {print $2"="$3}') + apt download -- $(dpkg -l | awk -v pattern="${CEPH_DEB_PKG_PATTERN}" '$0~pattern {print $2"="$3}') || exit 3 printf '%b\n' "Backup Ceph deb files in version : ${CEPH_VERSION}" - tar cf "${BKP_TAR_PATH}" ./*.deb > /dev/null 2>&1 + tar cf "${BKP_TAR_PATH}" ./*.deb > /dev/null 2>&1 || exit 4 ## Remove deb files rm -rf -- *.deb