-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Dmytro Galushko
committed
Mar 23, 2024
1 parent
94261ed
commit 68afdda
Showing
9 changed files
with
99 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
config/examples/docker-compose/docker-compose-torrent-low.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
version: '3.7' | ||
|
||
services: | ||
transmission_low: | ||
image: lscr.io/linuxserver/transmission:latest | ||
container_name: "transmission_low" | ||
environment: | ||
- PUID=1000 | ||
- PGID=1000 | ||
- TZ=Etc/UTC | ||
volumes: | ||
- ./workdir/config/transmission_low:/config | ||
- ./workdir/mediadata_hdd/low_quality:/downloads/complete | ||
- ./workdir/config/files_from_telegram_low:/watch | ||
ports: | ||
- 9094:9091 | ||
- 51416:51413 | ||
- 51416:51413/udp | ||
networks: | ||
torrent_network_low: | ||
networks: | ||
torrent_network_low: | ||
driver: bridge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
config/examples/etc/systemd/services/torrent-low-down.service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[Unit] | ||
Description=Torent client Service | ||
Requires=docker.service | ||
After=mount-hdd.service | ||
|
||
[Service] | ||
Type=oneshot | ||
RemainAfterExit=yes | ||
WorkingDirectory=/home/dima/media | ||
ExecStart=/usr/bin/docker-compose -f docker-compose-torrent-low.yml down | ||
TimeoutStartSec=0 | ||
|
||
[Install] | ||
WantedBy=default.target |
14 changes: 14 additions & 0 deletions
14
config/examples/etc/systemd/services/torrent-low-pull.service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[Unit] | ||
Description=Torrent update | ||
Requires=docker.service | ||
After=torrent-low-down.service | ||
|
||
[Service] | ||
Type=oneshot | ||
RemainAfterExit=yes | ||
WorkingDirectory=/home/dima/media | ||
ExecStart=/usr/bin/docker-compose -f docker-compose-torrent-low.yml pull | ||
TimeoutStartSec=0 | ||
|
||
[Install] | ||
WantedBy=default.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[Unit] | ||
Description=Torrent start | ||
Requires=docker.service | ||
After=torrent-low-pull.service | ||
|
||
[Service] | ||
Type=oneshot | ||
RemainAfterExit=yes | ||
WorkingDirectory=/home/dima/media | ||
ExecStart=/usr/bin/docker-compose -f docker-compose-torrent-low.yml up | ||
ExecStop=/usr/bin/docker-compose -f docker-compose-torrent-low.yml down | ||
TimeoutStartSec=0 | ||
|
||
[Install] | ||
WantedBy=default.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,26 @@ | ||
#!/bin/bash | ||
|
||
mkdir -p /home/app/transmission_config | ||
if [ -e /home/app/transmission_config/.settings.lock ]; then | ||
echo "The transmission service was already configured by this service" | ||
else | ||
cp /home/app/settings.json /home/app/transmission_config/settings.json | ||
echo "The transmission service configured by this service" | ||
echo "The transmission service configured by this service" > /home/app/transmission_config/.settings.lock | ||
fi | ||
TORRENT_IP_ARRAY=$(echo $TORRENT_IP | jq -r '.[]') | ||
|
||
mkdir -p /home/app/transmission_config_hdd | ||
if [ -e /home/app/transmission_config_hdd/.settings.lock ]; then | ||
echo "The transmission hdd service was already configured by this service" | ||
else | ||
cp /home/app/settings.json /home/app/transmission_config_hdd/settings.json | ||
echo "The transmission hdd service configured by this service" | ||
echo "The transmission hdd service configured by this service" > /home/app/transmission_config_hdd/.settings.lock | ||
fi | ||
for ITEM in $TORRENT_IP_ARRAY | ||
do | ||
NAME=$(echo $ITEM | jq -r '.name // empty') | ||
|
||
if [ -n "$NAME" ]; then | ||
CONFIG_PATH="/home/app/transmission_config_$NAME" | ||
else | ||
CONFIG_PATH="/home/app/transmission_config" | ||
fi | ||
|
||
mkdir -p $CONFIG_PATH | ||
|
||
if [ -e $CONFIG_PATH/.settings.lock ]; then | ||
echo "The transmission service was already configured by this service" | ||
else | ||
cp /home/app/settings.json $CONFIG_PATH/settings.json | ||
echo "The transmission service configured by this service" | ||
echo "The transmission service configured by this service" > $CONFIG_PATH/.settings.lock | ||
fi | ||
done | ||
|
||
java -Dlog4j.configuration=file:/home/app/log4j-${LOGS_LEVEL}.properties -jar /home/app/app.jar |