blocklist w/ cron

This commit is contained in:
Paul Hendryx
2016-10-18 08:41:49 -04:00
parent 2329699f53
commit 4f5055dc4a
6 changed files with 47 additions and 0 deletions

View 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

View File

@@ -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
View 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

View File

@@ -0,0 +1,3 @@
#!/usr/bin/with-contenv bash
/usr/sbin/crond -f -S -l 0 -c /etc/crontabs