Pomoc Problem z automatycznym uruchomieniem skryptow

lukjod

Entry Technician
Q Associate
2 Lipiec 2014
43
1
7
8
50
Warszawa
QNAP
TS-x64
Ethernet
1 GbE
Od 2 dni walcze z problemem ktory polega na tym ze skrypty moge bez problemu uruchomic z basha natomiast nie chca sie uruchamiac automatycznie tj po wywolaniu przez zakonczenie pobierania przez transmission oraz przez crona chociaz znajduje sie na jego liscie po wywolaniu crontab -l

Transmission przeinstalowalem od zera ale nie pomoglo.

Co moge jeszcze zrobic zanim sformatuje dysk w qnapie czego wolalbym uniknac ze wzgledu na mase dodatkowych skryptow.
 
Ok Panowie pewnie macie racje ale slabo u mnie z tymi skryptami wiec raczej je edytuje niz dopisuje wiec pewnie cos nie tak;

Zaczynam od settings.json:
Kod:
{
    "alt-speed-down": 50,
    "alt-speed-enabled": false,
    "alt-speed-time-begin": 540,
    "alt-speed-time-day": 127,
    "alt-speed-time-enabled": false,
    "alt-speed-time-end": 1020,
    "alt-speed-up": 50,
    "bind-address-ipv4": "0.0.0.0",
    "bind-address-ipv6": "::",
    "blocklist-enabled": true,
    "blocklist-url": "http://www.bluetack.co.uk/config/level1.gz",
    "cache-size-mb": 4,
    "dht-enabled": true,
    "download-dir": "/share/HDA_DATA/Download/transmission/completed",
    "download-queue-enabled": true,
    "download-queue-size": 5,
    "encryption": 0,
    "idle-seeding-limit": 30,
    "idle-seeding-limit-enabled": false,
    "incomplete-dir": "/share/HDA_DATA/Download/transmission/incomplete",
    "incomplete-dir-enabled": true,
    "lazy-bitfield-enabled": true,
    "lpd-enabled": true,
    "message-level": 2,
    "open-file-limit": 32,
    "peer-congestion-algorithm": "",
    "peer-id-ttl-hours": 6,
    "peer-limit-global": 1000,
    "peer-limit-per-torrent": 250,
    "peer-port": 51413,
    "peer-port-random-high": 65535,
    "peer-port-random-low": 49152,
    "peer-port-random-on-start": false,
    "peer-socket-tos": "default",
    "pex-enabled": true,
    "port-forwarding-enabled": true,
    "preallocation": 2,
    "prefetch-enabled": 1,
    "proxy": "",
    "proxy-auth-enabled": false,
    "proxy-auth-password": "",
    "proxy-auth-username": "",
    "proxy-enabled": false,
    "proxy-port": 80,
    "proxy-type": 0,
    "queue-stalled-enabled": true,
    "queue-stalled-minutes": 30,
    "ratio-limit": 1,
    "ratio-limit-enabled": true,
    "rename-partial-files": true,
    "rpc-authentication-required": true,
    "rpc-bind-address": "0.0.0.0",
    "rpc-enabled": true,
    "rpc-password": "{635f3386f0c5d0f936c6b7051ad0fd4dc740c8d8RHyOPu28",
    "rpc-port": 9091,
    "rpc-url": "/transmission/",
    "rpc-username": "admin",
    "rpc-whitelist": "127.0.0.1",
    "rpc-whitelist-enabled": false,
    "scrape-paused-torrents-enabled": true,
    "script-torrent-done-enabled": true,
    "script-torrent-done-filename": "/share/HDA_DATA/.qpkg/Filebot/trans.sh",
    "seed-queue-enabled": false,
    "seed-queue-size": 10,
    "speed-limit-down": 0,
    "speed-limit-down-enabled": false,
    "speed-limit-up": 100,
    "speed-limit-up-enabled": true,
    "start-added-torrents": true,
    "trash-original-torrent-files": false,
    "umask": 0,
    "upload-slots-per-torrent": 15,
    "utp-enabled": true,
    "watch-dir": "/share/HDA_DATA/Download/transmission/watch",
    "watch-dir-enabled": true
}

teraz skrypt trans.sh:
Bash:
#!/bin/bash

/share/HDA_DATA/.qpkg/Filebot/filebot.sh -script fn:amc "/share/HDA_DATA/Download/transmission/completed" --output "/share/HDA_DATA/Download" --log-file amc.log  --action copy --conflict override -non-strict --lang pl --def  minFileSize=30000 artwork=n plex=192.168.1.180 "exec=/share/HDA_DATA/.qpkg/Optware/bin/napi.sh -c -n -f subrip --stats '{file}'" "excludeList=filebot_processed_files.txt" "musicFormat=Music/{n}/{t}" "seriesFormat=TV/{n}/Season {s.pad(2)}/{s00e00} - {t}" "movieFormat=FILM/{n} ({y})/{n} ({y})"

Przy odpaleniu z ssh skrypt ladnie dziala i generuje poprawne logi, pomimo ze transmission w logu twierdzi ze skrypt odpala nic sie nie dzieje:
[log]...
[2014-07-14 20:35:32.812 CEST] Game of Thrones S04E06 HDTV x264-KILLERS[ettv] moving "/share/HDA_DATA/Download/transmission/incomplete/Game of Thrones S04E06 HDTV x264-KILLERS[ettv]/game.of.thrones.s04e06.hdtv.x264-killers.mp4" to "/share/HDA_DATA/Download/transmission/completed/Game of Thrones S04E06 HDTV x264-KILLERS[ettv]/game.of.thrones.s04e06.hdtv.x264-killers.mp4" (torrent.c:3094)
[2014-07-14 20:35:32.812 CEST] Game of Thrones S04E06 HDTV x264-KILLERS[ettv] Calling script "/share/HDA_DATA/.qpkg/Filebot/trans.sh" (torrent.c:2119)
[2014-07-14 20:39:25.111 CEST] Saved "/share/HDA_DATA/.qpkg/Transmission/conf/resume/Game of Thrones S04E06 HDTV x264-KILLERS[ettv].49f532ee98e210e6.resume" (variant.c:1214)
[2014-07-14 20:39:25.111 CEST] Saved "/share/HDA_DATA/.qpkg/Transmission/conf/stats.json" (variant.c:1214)
[2014-07-14 20:49:06.871 CEST] Game of Thrones S04E06 HDTV x264-KILLERS[ettv] Starting IPv4 DHT announce (firewalled, 150 nodes) (tr-dht.c:576)
[2014-07-14 20:53:51.691 CEST] Game of Thrones S04E06 HDTV x264-KILLERS[ettv] IPv4 DHT announce done (tr-dht.c:544)
[2014-07-14 21:09:24.931 CEST] Saved "/share/HDA_DATA/.qpkg/Transmission/conf/resume/Game of Thrones S04E06 HDTV x264-KILLERS[ettv].49f532ee98e210e6.resume" (variant.c:1214)[/log]
 
Ok Panowie pewnie macie racje ale slabo u mnie z tymi skryptami
Słabo, a jednak się za nie bierzesz - ...i to jest komplement! Bardzo dobrze! Takich ludzi nam tu trzeba.

Rzeczywiście popełniasz kilka błędów, bo skrypty, które są delegowane nie potrafisz "monitorować". A wystarczy, abyś do ich uruchomienia dopisał: tee -a /share/Public/skrypt.1.log.txt.

Czyli... Zainstaluj Optware, z konsoli:
Bash:
ipkg update
ipkg install tee

Następnie, przed uruchomieniem każdego osobno skryptu wyeksportuj:
Bash:
export >> /share/Public/skrypt.1.export.txt
env >> /share/Public/skrypt.1.env.txt
set >> /share/Public/skrypt.1.set.txt
(W ten sposób wyeksportujesz zmienne systemowe do pliku).

A później dopiero...
Bash:
/share/MD.../skrypt.sh
... aleeeeeee!
Bash:
/share/MD.../skrypt.sh | tee -a /share/Public/skrypt.1.log.txt
... - o właśnie tak! :D
STDOUT oraz STDERR pójdzie do pliku /share/Public/skrypt.1.log.txt

Pamiętaj, aby przypadkiem NIE uruchamiać skryptów w ten sposób: . /share/MD.../skrypt.sh lub sh /share/MD.../skrypt.sh.

Wywołanie . hello.sh działa jak polecenie source hello.sh, czyli wszystkie zmiany zmiennych środowiskowych, wrócą do skryptu macierzystego - tego, z którego go uruchamiasz. Natomiast sh nazwa.sh może wydelegować skrypt do osobnego i czystego środowisko, pozbawiając go zmiennych z macierzystego shella.

Nie poddawaj się :)
 
  • Lubię to
Reakcje: kaktus
Dzieki za tutorial,
po wielu probach wreszcie odkrylem problem, problemem jest PATH a raczej jeje niewlasciwa kolejnosc po zainstalowaniu Optware IPKG
tutaj instrukcja jak to poprawic w /etc/profile

Install Optware IPKG - QNAPedia

Dzieki wszystkim (w szczegolnosci Mariuszowi za motywacje)
thx !!!
 

Użytkownicy znaleźli tą stronę używając tych słów:

  1. whitelist transmission