Set up autorestart for transmission and fixed pkg-cache to allow zst files

This commit is contained in:
Actaeus Curabitur 2020-02-16 23:10:43 +00:00
parent 6abb660efe
commit f386dd2d18
4 changed files with 14 additions and 20 deletions

View file

@ -24,7 +24,7 @@ server
# Requests for actual packages should be served directly from cache if available.
# If not available, retrieve and save the package from an upstream mirror.
location ~ \.tar\.xz$ {
location ~ \.tar\.(xz|zst)$ {
try_files $uri @pkg_mirror;
}

View file

@ -8,11 +8,6 @@ transmission-settings:
- target: /mnt/video/transmission/settings.json
- force: true
transmission-service:
service.running:
- name: transmission
- enable: true
/opt/scripts/restart_transmission.sh:
file.managed:
- source: salt://roles/maintain/transmission/restart_transmission.sh
@ -21,6 +16,14 @@ transmission-service:
- mode: 644
- mkdirs: true
/opt/resolv.conf:
file.managed:
- source: salt://roles/maintain/transmission/resolv.conf
- user: root
- group: root
- mode: 644
- mkdirs: true
/etc/systemd/system/restart_transmission.service:
file.managed:
- source: salt://roles/maintain/transmission/restart_transmission.service

View file

@ -0,0 +1,3 @@
# Generated by resolvconf
domain eau.wi.charter.com
nameserver 172.16.40.20

View file

@ -3,19 +3,7 @@
hour=`date | grep -Po "\d\d:\d\d:\d\d" | grep -Po "^\d\d:\d\d"`
if [ "$hour" = "00:00" ] || [ "$hour" = "06:00" ] || [ "$hour" = "12:00" ] || [ "$hour" = "18:00" ];then
windscribe disconnect
windscribe connect
systemctl restart transmission.service
fi
currentip=`ps aux | grep rtorrent | grep -v "SCREEN" | grep -Po "\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}"`
tunip=`ip addr show tun0 | grep -Po "inet \d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}" | grep -Po "\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}"`
if [ "$currentip" = "$tunip" ];then
echo "transmission is up"
else
echo "restarting transmission"
windscribe disconnect
windscribe connect
systemctl restart windscribe.service
cp /opt/resolv.conf /etc/resolv.conf
systemctl restart transmission.service
fi