Raspberrypi omv: Difference between revisions

From 탱이의 잡동사니
Jump to navigation Jump to search
Line 46: Line 46:


==== Auto remove ====
==== Auto remove ====
토렌트 다운로드 완료 후, 자동 삭제 스크립트<ref>http://goedonthouden.com/2013/04/21/transmission-daemon-auto-remove-torrents/</ref>
토렌트 다운로드 완료 후, 자동 삭제 스크립트<ref>http://goedonthouden.com/2013/04/21/transmission-daemon-auto-remove-torrents/</ref>이다. 별다른 점은 없고, transmission 에 접속해서 다운로드 완료된 토렌트를 찾아 삭제하는 스크립트이다. cron 이나, 다른 별도의 툴을 이용하여 매번 스크립트를 실행해 주어야 한다.


<source lang=bash>
<source lang=bash>

Revision as of 08:10, 20 June 2016

Overview

Raspberry pi 를 이용한 NAS 서버 만들기.

Facilities

다음의 기능들이 가능해야 한다.

  • RAID 1
  • 내부/외부 NAS 접속
  • 네트워크 드라이브 설정 가능
  • 사용자 단위 디렉토리 지정(Permission 적용)
  • 토렌트 데몬 적용
  • Cron 작업 설정(외부 사이트 백업 작업)
  • 24 hours working

Hardware

다음의 사양으로 NAS를 구성한다. RAID 1 을 사용할 예정이므로 2베이 스토리지를 구했다.

  • Controller : Raspberrypi 3(4GB micro sd card)
  • Storage : 이지넷유비쿼터스 NEXT-702U3 RAID

Storage

장기간 미사용시, 슬립모드가 지원되는 제품을 구매할 예정이었으나, 해당 제품이 슬립모드 이후 다시 작동이 안된다는 리뷰가 있어서 일반 2Bay 스토리지 중 가장 저렴한 제품으로 선택함.

Open Media Vault

Raspberry pi NAS 를 위한 배포본이 있다. Open Media Vault. 아래의 링크에서 다운로드가 가능하다.

이미 다른 배포본이 설치된 상태에서 Open Media Vault 를 설치하고 싶다면 아래를 참조하자.

Settings

Start

OMV 는 웹 인터페이스를 제공한다. 단, Apache 가 아니라 nginx 로 구동된다. <source lang=bash> $ sudo service nginx start </source>

Torrent

24시간 Torrent 머신을 위해서는 다음 패키지 설치가 필요하다. <source lang=bash> $ sudo apt-get install transmission transmission-daemon </source>

Auto remove

토렌트 다운로드 완료 후, 자동 삭제 스크립트<ref>http://goedonthouden.com/2013/04/21/transmission-daemon-auto-remove-torrents/</ref>이다. 별다른 점은 없고, transmission 에 접속해서 다운로드 완료된 토렌트를 찾아 삭제하는 스크립트이다. cron 이나, 다른 별도의 툴을 이용하여 매번 스크립트를 실행해 주어야 한다.

<source lang=bash> $ cat removecompletedtorrents.sh

  1. !/bin/sh

TORRENTLIST=`transmission-remote --auth=user:password --list | sed -e '1d;$d;s/^ *//' | cut --only-delimited --delimiter=' ' --fields=1`

for TORRENTID in $TORRENTLIST do echo "* * * * * Operations on torrent ID $TORRENTID starting. * * * * *"

DL_COMPLETED=`transmission-remote --auth=user:password --torrent $TORRENTID --info | grep "Percent Done: 100%"` if [ "$DL_COMPLETED" != "" ]; then echo "Torrent #$TORRENTID is completed." echo "Removing torrent from list." transmission-remote --auth=user:password --torrent $TORRENTID --remove else echo "Torrent #$TORRENTID is not completed. Ignoring." fi echo "* * * * * Operations on torrent ID $TORRENTID completed. * * * * *" done </source>

cron job에 추가해주면 된다. 매 1분마다 동작한다.

* * * * * root ../../bin/removecompletedtorrents.sh

See also

References

<references />