feat(media): add mam-bonus daily upload-credit buyer
Spends MAM bonus points once a day (04:17) on upload credit via json/bonusBuy.php (spendtype=upload, "Max Affordable ") so seedbonus never caps out. Dedicated MAM session; rotated mam_id is persisted in a curl cookie jar under /config/mam-bonus. Skips when below the 50 GiB minimum; failures alert ntfy topic `mam`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4140fd49c8
commit
ca257000c8
3 files changed
+111
No files matched your search
@@ -336,6 +336,34 @@ services:
|
||||
ports:
|
||||
- "6161:6161"
|
||||
|
||||
mam-bonus:
|
||||
container_name: mam_bonus
|
||||
# Once a day, spend MAM bonus points on upload credit (json/bonusBuy.php,
|
||||
# spendtype=upload, "Max Affordable ") so seedbonus never caps out. Uses its
|
||||
# own dedicated MAM session (MAM_BONUS_MAM_ID); the rotating cookie is kept
|
||||
# in /config/mam-bonus. Failures go to ntfy topic `mam`. Script: ./mam-bonus.
|
||||
image: alpine:3.20
|
||||
restart: unless-stopped
|
||||
networks: [edge] # egress + ntfy:80 for failure alerts
|
||||
env_file:
|
||||
- stack.env
|
||||
volumes:
|
||||
- ./mam-bonus:/app:ro
|
||||
- /config/mam-bonus:/data
|
||||
entrypoint: ["/bin/sh", "-c"]
|
||||
command:
|
||||
- |
|
||||
apk add --no-cache curl jq tzdata >/dev/null
|
||||
# crond jobs get a bare env, so hand the job its vars via a file
|
||||
printenv | grep -E '^(MAM_BONUS_|TZ=)' | sed "s/^\([^=]*\)=\(.*\)/export \1='\2'/" > /etc/mam-bonus.env
|
||||
chmod 600 /etc/mam-bonus.env
|
||||
# busybox crond silently skips a crontab not owned by root
|
||||
echo '17 4 * * * . /etc/mam-bonus.env && /bin/sh /app/buy-upload.sh >> /proc/1/fd/1 2>&1' > /etc/crontabs/root
|
||||
chown root:root /etc/crontabs/root && chmod 600 /etc/crontabs/root
|
||||
exec crond -f -l 8 -c /etc/crontabs
|
||||
labels:
|
||||
- "com.centurylabs.watchtower.enable=false"
|
||||
|
||||
networks:
|
||||
media:
|
||||
name: media
|
||||
|
||||
Reference in new issue
Block a user