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

Incorrect code in "Stop if disk is full" Docker code? #196

Open
Sabb0 opened this issue Jun 6, 2024 · 0 comments
Open

Incorrect code in "Stop if disk is full" Docker code? #196

Sabb0 opened this issue Jun 6, 2024 · 0 comments

Comments

@Sabb0
Copy link

Sabb0 commented Jun 6, 2024

Hi all,

I was setting this up and had to change the code for docker to get it to work.

https://autobrr.com/usage/tips#create-the-script

#!/bin/sh
set -e

reqSpace=250000000 # 250GB
SPACE=$(df "/torrents" | awk 'END{print $4}')
if [ "$SPACE" -le $reqSpace ]
then
  echo "not enough space"
  echo "free $SPACE"
  exit 1
fi
echo "got space"
echo "free $SPACE"
exit 0

The {print $4} was displaying the % free of the disk, and not the byte free. I changed it to {print $3} and it worked.


#!/bin/sh
set -e

reqSpace=250000000 # 250GB
SPACE=$(df "/torrents" | awk 'END{print $3}')
if [ "$SPACE" -le $reqSpace ]
then
  echo "not enough space"
  echo "free $SPACE"
  exit 1
fi
echo "got space"
echo "free $SPACE"
exit 0

Not sure if this has been picked up before, or if it's unique to my system.... I'm new when it comes to looking at code!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant