AMC transmission-daemon script won't work

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
lospo
Posts: 24
Joined: 10 Apr 2015, 16:59

AMC transmission-daemon script won't work

Post by lospo »

Hi and good morning,

i've installed OpenElec (last stable 5.0.8) and i've configured transmission-daemon to run a script when torrent is done.

the script: (placed in /storage/transpp.sh)

Code: Select all

#!/bin/bash
filebot -script fn:amc --output "$HOME/Media" --log-file amc.log --action duplicate --conflict override -non-strict --def music=y artwork=y "ut_dir=$TR_TORRENT_DIR/$TR_TORRENT_NAME" "ut_kind=multi" "ut_title=$TR_TORRENT_NAME"
after save i run:

Code: Select all

chmod +rx /storage/transpp.sh
chmod 777 /storage/transpp.sh
and, at last, i configured transmission (settings.json)

Code: Select all

"script-torrent-done-enabled": true, 
"script-torrent-done-filename": "/storage/transpp.sh",
I can see in the log that transmission-daemon call the script, but nothing happends.
If i run the file manually, it works. (i can verify because filebot create a log at every launch.)

In OpenElec there is only one user: root, so i don't think it could be a permission issue.

Does anyone know why?
User avatar
rednoah
The Source
Posts: 23003
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC transmission-daemon script won't work

Post by rednoah »

I'd start by adding some logging to your transpp.sh so you can make sure that it is actually called.

e.g.

Code: Select all

whoami > /storage/user.log

Once you've made sure that filebot is definitely called, but doesn't start you can add some more logging:

Code: Select all

filebot -script fn:amc ...... > out.log 2> err.log
FileBot is either started successfully, or the shell will spit out some errors.
:idea: Please read the FAQ and How to Request Help.
lospo
Posts: 24
Joined: 10 Apr 2015, 16:59

Re: AMC transmission-daemon script won't work

Post by lospo »

Here is the new modified file transpp.sh:

Code: Select all

#!/bin/bash

whoami > /storage/user.log

filebot -script fn:amc --output "/var/media/SCARICO/MC" --log-file amc.log --action duplicate --conflict override -non-strict --def music=y artwork=y "ut_dir=$TR_TORRENT_DIR/$TR_TORRENT_NAME" "ut_kind=multi" "ut_title=$TR_TORRENT_NAME" > /storage/out.log 2> /storage/err.log

in my /storage/user.log

Code: Select all

root
and no out.log or err.log.
Now i'm really confused
User avatar
rednoah
The Source
Posts: 23003
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC transmission-daemon script won't work

Post by rednoah »

Add more logging:

Does filebot work?

Code: Select all

filebot -version > /storage/version.log 2>&1
Does filebot scripting work?

Code: Select all

filebot -script fn:sysinfo > /storage/sysinfo.log 2>&1
What's the ENVIRONMENT look like?

Code: Select all

filebot -script fn:sysenv > /storage/env.log 2>&1

And make sure your shell script is correct. And that "filebot" is actually filebot. ;)
:idea: Please read the FAQ and How to Request Help.
lospo
Posts: 24
Joined: 10 Apr 2015, 16:59

Re: AMC transmission-daemon script won't work

Post by lospo »

After a while (chmod dirs, files copy and paste part of code, and so on) i reached something,
now i have err.log with this inside:

Code: Select all

application.dir
and i have also out.log (with same date/time) but it is blank

Now i have to go to work, this evening i will do the other thing you write above.

Thank you!
User avatar
rednoah
The Source
Posts: 23003
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC transmission-daemon script won't work

Post by rednoah »

Did you edit filebot.sh at some point? Just making sure the filebot startup script isn't broken... cause I'm running out of ideas!
:idea: Please read the FAQ and How to Request Help.
lospo
Posts: 24
Joined: 10 Apr 2015, 16:59

Re: AMC transmission-daemon script won't work

Post by lospo »

rednoah wrote:Did you edit filebot.sh at some point? Just making sure the filebot startup script isn't broken... cause I'm running out of ideas!
no, why?
java is linked in /usr/local/bin and every user can use that, and when i try filebot from anywhere it can run.

I will check this too
lospo
Posts: 24
Joined: 10 Apr 2015, 16:59

Re: AMC transmission-daemon script won't work

Post by lospo »

My ideas are finishing.

Code: Select all


which filebot
/usr/bin/filebot

chmod 777 -R /usr/bin/filebot

which java
/usr/local/bin/java
chmod 777 -R /usr/local/bin/

My filebot.sh

Code: Select all

#!/bin/sh

APP_ROOT="/usr/share/filebot"
APP_DATA="$HOME/.filebot"

# add APP_ROOT to LD_LIBRARY_PATH
if [ ! -z "$LD_LIBRARY_PATH" ]
then
    export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$APP_ROOT"
else
    export LD_LIBRARY_PATH="$APP_ROOT"
fi

java -Dunixfs=false -DuseGVFS=false -DuseExtendedFileAttributes=true -DuseCreationDate=false
-Djava.net.useSystemProxies=false -Dsun.net.client.defaultConnectTimeout=10000 -Dsun.net.client.defaultReadTimeout=60000
-Djna.nosys=true -Dapplication.deployment=deb "-Dapplication.dir=$APP_DATA" "-Djava.io.tmpdir=$APP_DATA/temp"
 "-Dnet.filebot.AcoustID.fpcalc=$APP_ROOT/fpcalc" -jar "$APP_ROOT/FileBot.jar" "$@"
my postprocess

Code: Select all

#!/bin/bash
filebot -script fn:amc --output "/media/DWL/MC" --log-file amc.log --action duplicate --conflict override -non-strict --def music=y artwork=y "ut_dir=$TR_TORRENT_DIR/$TR_TORRENT_NAME" "ut_kind=multi" "ut_title=$TR_TORRENT_NAME" > /media/DWL/out.log 2>/media/DWL/err.log
for some reason i can launch transpp.sh from console with no errors, but i cannot launch from transmission-daemon.

if i change my postprocess to this:

Code: Select all

#!/bin/bash
filebot -version  > /media/DWL/out.log 2>/media/DWL/err.log
works, in my out.log i have

Code: Select all

FileBot 4.6 (r3052) / Java(TM) SE Runtime Environment 1.8.0_60 (headless)
I hope you have some ideas better than mine.
lospo
Posts: 24
Joined: 10 Apr 2015, 16:59

Re: AMC transmission-daemon script won't work

Post by lospo »

Change linux distro (now i'm on kodibuntu), same trouble.
Is it a malediction?

My postprocess file:

Code: Select all

#!/bin/bash
echo filebot -script fn:amc --output "/media/DWL/MC" --log-file /media/DWL/amc.log --action duplicate --conflict override -non-strict --def music=y artwork=y "ut_dir=$TR_TORRENT_DIR/$TR_TORRENT_NAME" "ut_kind=multi" "ut_title=$TR_TORRENT_NAME">/media/DWL/ech.log
filebot -script fn:amc --output "/media/DWL/MC" --log-file /media/DWL/amc.log --action duplicate --conflict override -non-strict --def music=y artwork=y "ut_dir=$TR_TORRENT_DIR/$TR_TORRENT_NAME" "ut_kind=multi" "ut_title=$TR_TORRENT_NAME">/media/DWL/out.log 2>/media/DWL/err.log
My /media/DWL/amc.log file

Code: Select all

/.filebot
/.filebot
my /media/DWL/ech.log

Code: Select all

filebot -script fn:amc --output /media/DWL/MC --log-file /media/DWL/amc.log --action duplicate --conflict override -non-strict --def music=y artwork=y ut_dir=/media/DWL/Scaricati/Mr.Robot.S01E07.HDTV.x264-DEFiNE[ettv] ut_kind=multi ut_title=Mr.Robot.S01E07.HDTV.x264-DEFiNE[ettv]
my /media/DWL/err.log

Code: Select all

/.filebot
my /media/DWL/out.log

Code: Select all

Locking /media/DWL/amc.log
Please someone help me
User avatar
rednoah
The Source
Posts: 23003
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC transmission-daemon script won't work

Post by rednoah »

You could try using the portable package.

Maybe a there's a few environment variables that are required in the filebot.sh launcher that are somehow not defined in the minimal cron environment?
:idea: Please read the FAQ and How to Request Help.
lospo
Posts: 24
Joined: 10 Apr 2015, 16:59

Re: AMC transmission-daemon script won't work

Post by lospo »

rednoah wrote:You could try using the portable package.

Maybe a there's a few environment variables that are required in the filebot.sh launcher that are somehow not defined in the minimal cron environment?
I don't know but with the portable package and a few tweaks it works really good, at the first attempt. :D :D :D

Thank you @rednoah, i cannot do this without you
Post Reply