mirror of
https://github.com/linuxserver/docker-transmission.git
synced 2025-11-04 18:45:49 +01:00
blocklist w/ cron
This commit is contained in:
12
root/defaults/blocklist-update.sh
Normal file
12
root/defaults/blocklist-update.sh
Normal file
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
|
||||
RESULT=`jq '.["blocklist-enabled"]' settings.json`
|
||||
REQUIRE_AUTH=`jq '.["rpc-authentication-required"]' settings.json`
|
||||
|
||||
if [ $RESULT == true ]; then
|
||||
if [ $REQUIRE_AUTH == true ]; then
|
||||
transmission-remote -n $UIUSER:$UIPASS --blocklist-update
|
||||
else
|
||||
transmission-remote --blocklist-update
|
||||
fi
|
||||
fi
|
||||
@@ -8,10 +8,17 @@ mkdir -p \
|
||||
[[ ! -f /config/settings.json ]] && cp \
|
||||
/defaults/settings.json /config/settings.json
|
||||
|
||||
# copy blocklist-update script
|
||||
[[ ! -f /config/blocklist-update.sh ]] && cp \
|
||||
/defaults/blocklist-update.sh /config/blocklist-update.sh
|
||||
|
||||
# permissions
|
||||
chown abc:abc \
|
||||
/config/settings.json \
|
||||
/config/blocklist-update.sh \
|
||||
/downloads \
|
||||
/downloads/complete \
|
||||
/downloads/incomplete \
|
||||
/watch
|
||||
|
||||
chmod 755 /config/blocklist-update.sh
|
||||
|
||||
10
root/etc/crontabs/root
Normal file
10
root/etc/crontabs/root
Normal file
@@ -0,0 +1,10 @@
|
||||
# do daily/weekly/monthly maintenance
|
||||
# min hour day month weekday command
|
||||
*/15 * * * * run-parts /etc/periodic/15min
|
||||
0 * * * * run-parts /etc/periodic/hourly
|
||||
0 2 * * * run-parts /etc/periodic/daily
|
||||
0 3 * * 6 run-parts /etc/periodic/weekly
|
||||
0 5 1 * * run-parts /etc/periodic/monthly
|
||||
|
||||
# run daily blocklist update
|
||||
0 3 * * * /config/blocklist-update.sh 2>&1
|
||||
3
root/etc/services.d/cron/run
Normal file
3
root/etc/services.d/cron/run
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
|
||||
/usr/sbin/crond -f -S -l 0 -c /etc/crontabs
|
||||
Reference in New Issue
Block a user