Track seeding status
This commit is contained in:
parent
95942d8d39
commit
c54c4d785f
29
.config/scripts/cron/seed-status.sh
Executable file
29
.config/scripts/cron/seed-status.sh
Executable file
@ -0,0 +1,29 @@
|
||||
TIME=$(date +%s)
|
||||
|
||||
source /Users/noahheague/.config/scripts/util/secret.sh
|
||||
API_KEY=$(getSecret "/server/mac-mini-1/seed-api-key")
|
||||
API_URL=$(getSecret "/server/mac-mini-1/seed-api-url")
|
||||
|
||||
SEED_COUNT=$(curl --request GET \
|
||||
--silent \
|
||||
--url "$API_URL" \
|
||||
--header "X-API-Key: $API_KEY" \
|
||||
| jq ".response.community.seeding")
|
||||
|
||||
if [ "$SEED_COUNT" -le "0" ]; then
|
||||
if [ ! -f /tmp/seed-timestamp.txt ]; then
|
||||
echo $TIME > /tmp/seed-timestamp.txt;
|
||||
fi;
|
||||
|
||||
SAVED_TIME=$(cat /tmp/seed-timestamp.txt)
|
||||
echo "Saved Timestamp: $SAVED_TIME"
|
||||
echo "Current Time: $TIME"
|
||||
SAVED_TIME_PLUS=$(( $SAVED_TIME + 86400 ));
|
||||
echo "Plus: $SAVED_TIME_PLUS"
|
||||
|
||||
if [ $SAVED_TIME_PLUS -ge $TIME ]; then
|
||||
Users/noahheague/.config/scripts/util/webhook.sh \
|
||||
-c "torrent" \
|
||||
-m "Seeding has been paused."
|
||||
fi
|
||||
fi
|
Loading…
Reference in New Issue
Block a user