Change behaviour of transmission at start (so that cannot start without VPN)

This commit is contained in:
Alexandre CATTEAU 2023-02-12 17:37:38 +01:00
parent 9f3b607414
commit 5722bc62da
3 changed files with 4 additions and 1 deletions

View File

@ -46,6 +46,7 @@ fi
if [ "$dl_server" = "yes" ]; then
$sudo cp $run_directory/systemd-templates/transmission-daemon.service /etc/systemd/system/
$sudo sed -i -e "s/PH_NAS_USER/$nas_user/g" /etc/systemd/system/transmission-daemon.service
$sudo sed -i -e "s:PH_DIRECTORY:$run_directory:g" /etc/systemd/system/transmission-daemon.service
$sudo sed -i -e "s/PH_AUTHORIZED_ADDRESSES/$authorized_ips/g" /etc/systemd/system/transmission-daemon.service
$sudo sed -i -e "s/PH_USER/$user/g" /etc/systemd/system/transmission-daemon.service
$sudo sed -i -e "s/PH_PASSWORD/$password/g" /etc/systemd/system/transmission-daemon.service

View File

@ -1,12 +1,12 @@
[Unit]
Description=Transmission BitTorrent Daemon (KTO)
Requires=transmission-vpn.service
BindsTo=transmission-vpn.timer
After=network.target transmission-vpn.timer
[Service]
User=PH_NAS_USER
Type=notify
ExecStartPre=PH_DIRECTORY/transmission-vpn.sh
ExecStart=/usr/bin/transmission-daemon -f --log-error -a PH_AUTHORIZED_ADDRESSES -C -t -u PH_USER -v PH_PASSWORD -w PH_DL_LOCATION
ExecStop=/bin/kill -s STOP $MAINPID
ExecReload=/bin/kill -s HUP $MAINPID

View File

@ -5,6 +5,8 @@
# This will be achieved with a timer started and stopped with transmission service
# On transmission starting
# When the script exits with failure, associated service should try to start transmission service
# NOTE not on transmission starting, as this script is not run by its service; it means there's an issue with VPN at
# start, and this should be looked at manually
# Thus this script will be executed again
# We can enter an infinite loop, but this will effectively prevent transmission from connecting
# If both services are stopped, this script will never be run by error