Exit script if some commands return error
This commit is contained in:
parent
969fa130e0
commit
baaf251c00
|
@ -33,10 +33,10 @@ if [ "$(command -v ceph)" ]; then
|
||||||
|
|
||||||
## Download deb files of all ceph related packages installed on the system
|
## 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."
|
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}"
|
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
|
## Remove deb files
|
||||||
rm -rf -- *.deb
|
rm -rf -- *.deb
|
||||||
|
|
Loading…
Reference in New Issue