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

@@ -10,11 +10,16 @@ LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DA
RUN \
apk add --no-cache \
curl \
jq \
transmission-cli \
transmission-daemon
# copy local files
COPY root/ /
# add files
ADD cron/ /etc/cron.d/
# ports and volumes
EXPOSE 9091 51413
VOLUME /config /downloads /watch

View File

@@ -27,6 +27,7 @@ docker create --name=transmission \
-v <path to downloads>:/downloads \
-v <path to watch folder>:/watch \
-e PGID=<gid> -e PUID=<uid> \
-e UIUSER=<uiuser> -e UIPASS=<uipass>
-e TZ=<timezone> \
-p 9091:9091 -p 51413:51413 \
-p 51413:51413/udp \
@@ -48,6 +49,8 @@ http://192.168.x.x:8080 would show you what's running INSIDE the container on po
* `-v /watch` - watch folder for torrent files
* `-e PGID` for GroupID - see below for explanation
* `-e PUID` for UserID - see below for explanation
* `-e UIUSER` for WebUI Username - see Updating Blocklists Automatically for explanation
* `-e UIPASS` for WebUI Password - see Updating Blocklists Automatically for explanation
* `-e TZ` for timezone information, eg Europe/London
It is based on alpine linux with s6 overlay, for shell access whilst the container is running do `docker exec -it transmission /bin/bash`.
@@ -81,6 +84,13 @@ this requires 3 settings to be changed in the settings.json file.
Transmission will convert it to a hash when you restart the container after making the above edits.
## Updating Blocklists Automatically
This requires `"blocklist-enabled": true,` to be set. By setting this to true, it is assumed you have also populated `blocklist-url` with a valid block list.
If you have webui security enabled, you will need to set the `UIUSER` and `UIPASS` environment variables in your docker configuration.
The automatic update will run once a day at 3am local server time.
## Info

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