This is an old revision of the document!
- Linux
- Windows
- Android
Media Ditorium ─ AUTiSM Rainbow
- Name: AUTiSM Rainbow (official) | 라몽 (korean)
Specification
- Video streaming and archives
+Work logs
replaceHDD enclosure for~/repository&~/storage— Updated on 2018/09/04 20:33fresh installationof Raspbian OS — Updated on 2018/09/01 17:32- change
microSD memoryfor Raspbian OS — Updated on 2018/05/09 12:59 static IPusingdhcpcd.confwith fallback option — Updated on 2018/02/25 09:28
+Que to do
- Register user-create shell script for autocomplete enabled — bash-completion
- List up the aliases and create user-defined command
- FlexGet configuration before fresh installation
Setup Samba service
Run update
sudo apt-get update && sudo apt-get dist-upgrade -y
Install samba server and related components
sudo apt-get install samba samba-common-bin
Add samba user
sudo smbpasswd -a userid
Type user's password twice correctly edit samba config file — /etc/samba/smb.conf
[userid] comment = Any description showing your sharing path = /home/userid valid user = userid #writable = yes read only = no browseable = yes
If you need to specify Work Group name for Windows, find workgroup and edit
workgroup = YOURWORKGRP
restart samba service
sudo /etc/init.d/samba restart
Setup Transmission
Build up Transmission (daemon + web remote) and configuration. Reference: Fundamental information on BitTorrent in
Korean (한국어). User should understand basic operation on BitTorrent. If not, your server will have tremendous traffics, which reduce your network resource.
Install transmission
sudo apt-get install transmission-daemon
Decide a few directories to store torrent files for downloads. Do not use directory located on SD memory but use directories mount on USB attached storages. Assume external USB HDD is attached at /dev/sda and mount on /home/userid/BitTorrent
sudo mount /dev/sda /home/userid/BitTorrent
Create three directories for transmission to work efficiently.
mkdir /home/userid/BitTorrent/Downloaded mkdir /home/userid/BitTorrent/Downloading mkdir /home/userid/BitTorrent/WillDownload
Downloaded is for the finished files, Downloading is for the downloading files (still downloading or seeding) and WillDownload is used for watching directory, where you put .torrent file will start downloading automatically.
Basically, transmission daemon is operated by user named debian-transmission and also group debian-transmission. Therefore, next step you have to set folder and file permission.
sudo chgrp debian-transmission /home/userid/BitTorrent/Downloaded sudo chgrp debian-transmission /home/userid/BitTorrent/Downloading sudo chgrp debian-transmission /home/userid/BitTorrent/WillDownload sudo chmod 770 /home/userid/BitTorrent/Downloaded sudo chmod 770 /home/userid/BitTorrent/Downloading sudo chmod 770 /home/userid/BitTorrent/WillDownload
BitTorrent directories allow full permission to owner and debian-transmission group and userid is also its member. So debian-transmission and userid users have full permission to create, edit and delete.
Edit /etc/transmission-daemon/settings.json
"download-dir": "/home/userid/BitTorrent/Downloaded", "incomplete-dir": "/home/userid/BitTorrent/Downloading", "incomplete-dir-enabled": true, "rpc-authentication-required": true, "rpc-bind-address": "0.0.0.0", "rpc-enabled": true, "rpc-password": "TYPE_YOUR_OWN_PASSWORD_HERE", "rpc-port": 9090, "rpc-url": "/transmission/", "rpc-username": "userid", "rpc-whitelist": "127.0.0.1", "rpc-whitelist-enabled": false, "umask": 6,
umask is sensitive matter to security. If you want to copy/move through samba connection, Set umask as 1 with no further consideration.
Append two lines before }
"watch-dir": "/home/userid/BitTorrent/WillDownload", "watch-dir-enabled": true
Last string line does not have ,. Save settings.json and restart transmission daemon.
sudo systemctl restart transmission-daemon.service
If there is no error, transmission daemon works correctly and you can access transmission web remote in your browser.
Assume machine's IP address (internal) is 192.168.50.10. Transmission Web Interface can be accessed with http://192.168.50.10:9090. Port number can be changed “rpc-port”: 9090 and it could be better when it comes to security.
Set download/upload speed limits in options.
Edit html page: edit /usr/share/transmission/web/index.html
Multiple Transmission daemons in single machine
Can apply to duplicate (any) services with (if any) different port or setting.
sudo systemctl stop transmission-daemon.service
Update with the latest ones
sudo apt-get update && sudo apt-get dist-upgrade -y
Copy daemon resources and scripts. Call second daemon conveyance-daemon (whatever you want, it's fine.)
sudo cp /usr/bin/transmission-daemon /usr/bin/conveyance-daemon sudo cp /etc/init.d/transmission-daemon /etc/init.d/conveyance-daemon sudo cp -a /var/lib/transmission-daemon /var/lib/conveyance-daemon sudo cp -a /etc/transmission-daemon /etc/conveyance-daemon sudo cp /etc/default/transmission-daemon /etc/default/conveyance-daemon
Create symbolic link for second daemon.
sudo ln -sf /etc/conveyance-daemon/settings.json /var/lib/conveyance-daemon/info/settings.json
Edit /etc/init.d/conveyance-daemon
NAME=transmission-daemon to NAME=conveyance-daemon
Edit /etc/conveyance-daemon/settings.json. Compare and check settings with default values.
"download-dir": "new download path of conveyance-daemon" "peer-port": 51414, "rpc-username": "NEW_USER", "rpc-password": "TYPE_YOUR_NEW_PASSWORD_HERE", "rpc-port": 9092, "rpc-whitelist-enabled": false,
Edit /etc/default/conveyance-daemon
CONFIG_DIR="/var/lib/conveyance-daemon/info"
Update init.d to let conveyance-daemon start at
sudo update-rc.d conveyance-daemon defaults
Start original and duplicated daemon to check any errors or conflicts
sudo systemctl start transmission-daemon.service sudo systemctl start conveyance-daemon.service
If no error, check with Transmission Web Interface. Original one is http://server.ip:9090 and Second one is http://server.ip:9092 according to your port settings.
Notify completion of downloading
When downloading in Transmission is finished, send simple notification via PushBullet or Telegram.
Option A. via PushBullet
get API key from PushBullet — Create Access Token
- API key is like
o.8jh96v9p49vW73X3U4HByxo87MLVw4kM
Option B. via Telegram
get API key & chat_id — Create your own Bot with /newbot command.
Create Bot and finish settings such as Bot Name, Description, Profile image and so on.
Find API key from BotFather.
- API key is like
977114901:279gLSo-d7XZokF4QqM69ZfF3xBKtnYQqMk
Find chat_id from API key
To figure out chat_id,
https://api.telegram.org/bot977114901:279gLSo-d7XZokF4QqM69ZfF3xBKtnYQqMk/getUpdates
If this URL returns no chat_id, go to Telegram and give some chats with your Bot. Of course, your Bot never answers you.
After sending some chats, go URL again. It shows something like {“id”:29329664,“first_name”: ….}, and id is your chat_id is 29329664
Stop daemon: sudo systemctl stop transmission-daemon.service
Edit sudo vi /etc/transmission-daemon/settings.json
"script-torrent-done-enabled": true,
"script-torrent-done-filename": "/opt/script/download-done.sh",
Make execute file.
sudo mkdir /opt/script sudo touch /opt/script/download-done.sh sudo chown debian-transmission:debian-transmission /opt/script/download-done.sh sudo chmod +x /opt/script/download-done.sh sudo vi /opt/script/download-done.sh
Script for Pushbullet (Option A)
#!/bin/bash curl -u o.8jh96v9p49vW73X3U4HByxo87MLVw4kM: \ -X POST https://api.pushbullet.com/v2/pushes \ --header 'Content-Type: application/json' \ --data-binary "{ \"type\": \"note\", \"title\": \"Transmission in EPiGEN\", \"body\": \"$TR_TORRENT_NAME file is ready @ $TR_TIME_LOCALTIME.\" }"
Script for Telegram (Option B)
#!/bin/bash TEXT="$TR_TORRENT_NAME is finished" curl -d "chat_id=29329664&text=$TEXT" \ https://api.telegram.org/bot977114901:279gLSo-d7XZokF4QqM69ZfF3xBKtnYQqMk/sendMessage
Restart daemon sudo systemctl start transmission-daemon.service