Transmission-daemon for Debian 11, Ubuntu 2X.XX, OMV 6.X 트랜스미션 토렌트 설치. 리눅스.

#

# Transmission-daemon for Debian 11, Ubuntu 2X.XX, OMV 6.X

#

# 2022/03/22

#

1. # apt-get -y install transmission-daemon transmission-cli

2. # transmission-daemon --version

transmission-daemon 3.00 (bb6b5a062e)

3. # more /lib/systemd/system/transmission-daemon.service

[Unit]

Description=Transmission BitTorrent Daemon

After=network.target

[Service]

User=debian-transmission

Type=notify

ExecStart=/usr/bin/transmission-daemon -f --log-error # --config-dir=/etc/transmission-daemon

ExecStop=/bin/kill -s STOP $MAINPID

ExecReload=/bin/kill -s HUP $MAINPID

NoNewPrivileges=true

[Install]

WantedBy=multi-user.target

4. # systemctl stop transmission-daemon.service

5. # vi /etc/transmission-daemon/settings.json

- Symbolic link file : /var/lib/transmission-daemon/.config/transmission-daemon/settings.json

{

"_comment": "/etc/transmission-daemon/settings.json on OMV6 @ 2022/03/22",

"utp-enabled": true

.

.

.

}

6. Permission setup for user name

# chown -R debian-transmission:debian-transmission [path of directory]

- 본 예제에서 [path of directory] = /dn/torrent

- 이렇게 설정하면 토렌트 다운로드는 되지만, /dn/torrent를 SMB, FTP로 접속하면 권한이 없어서 수정이 안되는 문제가 생긴다. 그래서 아래와 같이 그룹권한으로 처리한다.

# chown -R [user name]:[user group] [path of directory]

- /dn/torrent 이하 모든 디렉토리와 파일의 오너를 user name, user group로 수정

# usermod -a -G [user group] debian-transmission

- debian-transmission 사용자를 내가 속한 user group으로 등재한다.

# chmod -R 770 [path of directory]

- user, group만 읽기/쓰기/실행하기 권한을 주고, other는 권한을 삭제한다.

# 위 내용이 뭔말인지 이해가 안되면,

- OMV > 저장소 > 공유폴더 > [path of directory] > 권한 > [user name]에게 Read/Write 권한을 준다.

- OMV > 저장소 > 공유폴더 > [path of directory] > Access control list > debian-transmission > Read/Write 권한을 준다.

7. # systemctl restart transmission-daemon.service

8. Enjoy It !

#!/bin/bash

#

# Automation script for transmission-daemon

#

# Money is most most most powerfullllll weapon :)

#

# 2019/03/12 ---> 2020/02/23 ---> 2020/11/16

#

# bin path

TORRENT_BIN='/usr/bin/transmission-remote'

# path of torrent disk

TORRENT_DISK="/dn"

# ING & END folder path

# ING_FOLDER="$TORRENT_DISK/torrent/ING"

END_FOLDER="$TORRENT_DISK/torrent/END"

# port, user name, password

PORT='????'

USER='????'

PASS='????'

# force restart & remove torrent

NUM=0

while [ $NUM -lt 1 ]; do

{

# get torrent list

TORRENT_LIST=`$TORRENT_BIN $PORT --auth $USER:$PASS --list | sed -e '1d;$d;s/^ *//' | cut --only-delimited --delimiter=" " --fields=1`

# loop all of the list number

for TORRENT_ID in $TORRENT_LIST; do

{

# get the number of complete

ISEND=`$TORRENT_BIN $PORT --auth $USER:$PASS --torrent $TORRENT_ID --info | grep "Percent Done: 100%"`

# move the file to END FOLDER & removal seed

if [ "$ISEND" ]; then

{

sleep 1

# move

$TORRENT_BIN $PORT --auth $USER:$PASS --torrent $TORRENT_ID --move $END_FOLDER > /dev/null 2>&1

sleep 1

# remove

$TORRENT_BIN $PORT --auth $USER:$PASS --torrent $TORRENT_ID --remove > /dev/null 2>&1

}

fi #### if []

}

done #### for{}

# service restart

ISACTIVE=`service transmission-daemon status | grep "Active: active (running)"`

if [ ! "$ISACTIVE" ]; then

{

service transmission-daemon restart > /dev/null 2>&1

}

fi

# force restart all torrents

$TORRENT_BIN $PORT --auth $USER:$PASS --torrent all --start > /dev/null 2>&1

sleep 60

}

done #### while []