Exit script if some commands return error

This commit is contained in:
Jeremy Gardais 2019-07-24 11:26:09 +02:00
parent 969fa130e0
commit baaf251c00
1 changed files with 2 additions and 2 deletions

View File

@ -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