Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deploysh data retention failure #179

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Update deploy.sh
  • Loading branch information
aarz-snl committed Feb 6, 2024
commit c839d97a4d3928f2a214c38adb2d16e8b2c6aaa7
19 changes: 10 additions & 9 deletions Chapter 3 Files/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -537,15 +537,16 @@ function data_retention() {
# Show ext4 disk
DF_OUTPUT="$(df -h -l -t ext4 --output=source,size /var/lib/docker)"

# Pull device name
DISK_DEV="$(echo "$DF_OUTPUT" | grep -Po '[0-9]+G')"

# Pull device size
DISK_SIZE="${DISK_DEV/G/}"

# Check if DISK_SIZE is empty or not a number
if ! [[ "$DISK_SIZE" =~ ^[0-9]+$ ]]; then
echo -e "\e[31m[!]\e[0m DISK_SIZE not an integer or is empty - exiting."
# Pull device name and size
DISK_DEV="$(echo "$DF_OUTPUT" | grep -Po '[0-9]+[GT]')"

# Determine if the size is in Gigabytes or Terabytes
if echo "$DISK_DEV" | grep -q 'G'; then
DISK_SIZE="${DISK_DEV/G/}"
elif echo "$DISK_DEV" | grep -q 'T'; then
DISK_SIZE=$(echo "$DISK_DEV" | sed 's/T//' | awk '{print $1 * 1024}') # Convert to GB's for logic below
else
echo -e "\e[31m[!]\e[0m Error: Unable to determine disk size - exiting."
exit 1
fi

Expand Down