Download Station 다운로드완료시 push 처리 방법

[참조] https://gabrielkim.tistory.com/entry/Synology-Download-Station%EC%97%90-Telegram-%EC%95%8C%EB%9E%8C-%EC%A0%81%EC%9A%A9%ED%95%98%EA%B8%B0

  1. 다운로드 완료 후 실행될 스크립트 작성 (예. downloadComplete.sh)
    • 메시지 발송 url 및 파라메터는 로켓챗이나 텔레그램 push 방법을 참조바랍니다.

!/bin/sh

URL=”수신url”

function send_message {
res=$(/usr/bin/curl -H “Content-type:application/json” $URL -d “{\”text\”: \”Synology NAS DownloadStation : $TR_TORRENT_NAME download complete.\” }”)
}

send_message
/bin/psql -U postgres -d download -c “DELETE FROM Download_queue WHERE status IN (‘5′,’7′,’8’)”

  1. 쉘 스크립트 권한 변경
    • chmod 755 downloadComplete.sh
  2. download station 중지
  3. /var/packages/DownloadStation/scripts/start-stop-status 수정
    • settings.json 를 삭제하는 부분을 remark 처리 (맨 앞에 # 추가)
  4. /var/packages/DownloadStation/etc/download/settings.json, /usr/syno/etc/packages/DownloadStation/download/settings.json 수정
    • script-torrent-done-enabled 변경 : false -> true
    • script-torrent-done-filename 변경 : “” -> “스크립트 경로/downloadComplete.sh”
  5. /etc/postgresql/pg_hba.conf 수정
    • local   all             postgres                                peer map=pg_root => trust 로 변경
  6. postgresql 을 재시작
    • /usr/syno/etc.defaults/rc.sysv/pgsql.sh restart