Unregistered only when launched from script

Support for Ubuntu and other Desktop Linux distributions
Post Reply
evilsephiroth
Power User
Posts: 7
Joined: 27 Jul 2014, 16:21

Unregistered only when launched from script

Post by evilsephiroth »

Hi,
I have a working license.
Registered to the root user.

Code: Select all

FileBot 4.8.2 (r5789)
JNA Native: 5.2.2
MediaInfo: net.filebot.mediainfo.MediaInfoException: Unable to load amd64 (64-bit) native library libmediainfo.so: Unable to load library 'mediainfo': Native library (linux-x86-64/libmediainfo.so) not found in resource path (/usr/share/filebot/jar/filebot.jar)
7-Zip-JBinding: 9.20
Chromaprint: 1.4.2
Extended Attributes: OK
Unicode Filesystem: OK
Script Bundle: 2018-10-05 (r536)
Groovy: 2.5.1
JRE: Java(TM) SE Runtime Environment 10.0.2
JVM: 64-bit Java HotSpot(TM) 64-Bit Server VM
CPU/MEM: 2 Core / 1 GB Max Memory / 35 MB Used Memory
OS: Linux (amd64)
HW: Linux iterprohp 4.15.0-38-generic #41-Ubuntu SMP Wed Oct 10 10:59:38 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
DATA: /root/.filebot
Package: DEB
License: FileBot License P4309082 (Valid-Until: 2019-08-18)
Done ヾ(@⌒ー⌒@)ノ
I have setup a Systemd unit file and a script triggering on file changes.

Systemd Unit

Code: Select all

[Unit]
Description=Filebot movie service
After=network.target

[Service]
Type=simple
PIDFile=/run/filebot_movie.pid
ExecStart=/bin/sh -c /srvData/repo/filebotJobs/movie.sh
ExecStop=/bin/kill -9 $MAINPID
TimeoutStopSec=60
StandardOutput=file:/srvData/repo/filebotJobs/movieExecution.log
StandardError=file:/srvData/repo/filebotJobs/movieError.log
[Install]
WantedBy=multi-user.target
Script:

Code: Select all

#!/bin/sh

SETTLE_DOWN_TIME=60
export HOME=/root/.filebot
inotifywait -m /srvData/repo/torrent/downloads/completed/movies -e create -e moved_to -e modify --exclude '/[.@]' --format '%w%f' $INOTIFYWAIT_OPTS | stdbuf -oL uniq | while read -r FILE; do
        # file may yield inode/x-empty for new files
        sleep "$SETTLE_DOWN_TIME"

        # abort if the file has been modified while we were asleep
        if [ `find "$FILE" -type f -newermt "$SETTLE_DOWN_TIME seconds ago" -print -quit` ]; then
                echo "Modified: $FILE"
                continue
        fi

        # e.g. video.mp4: video/mp4
        if file --mime-type "$FILE" | egrep "directory|video|audio|empty|octet-stream"; then
                filebot -script fn:amc --action hardlink --conflict auto --output /srvData/repo/plex -non-strict /srvData/repo/torrent/downloads/completed/movies --log-file /srvData/repo/filebotJobs/movie_amc.log --def excludeList="/srvData/repo/filebotJobs/.movieexcludes" --def movieFormat="movie/{n} ({y})/{n} ({y}){' CD'+pi}{'.'+lang}" --def skipExtract=y --def ut_label=movie  --def subtitles=en
        fi
done
Sadly, when run from systemd as root user, Filebot results UNREGISTERED.

The process is ran as root so I can't understand why is UNREGISTERED only when run from script.

Thanks in advance
User avatar
rednoah
The Source
Posts: 22986
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Unregistered only when launched from script

Post by rednoah »

Please run filebot -script fn:sysinfo and filebot -script fn:sysenv and post the output, once by logging in manually, and then again by having systemd do it.

Presumably, the environment is different, so by comparing the two outputs we can figure out what's different. Maybe $USER is not set. Maybe $HOME is set incorrectly. Maybe running as different user with different permissions.

:idea: viewtopic.php?f=4&t=3067


EDIT:

This is probably wrong, since FileBot will take the $HOME folder, and create .filebot inside that, meaning you'll end up with /root/.filebot/.filebot as app data folder:

Code: Select all

export HOME=/root/.filebot
Probably better:

Code: Select all

export HOME=/root
:idea: Please read the FAQ and How to Request Help.
evilsephiroth
Power User
Posts: 7
Joined: 27 Jul 2014, 16:21

Re: Unregistered only when launched from script

Post by evilsephiroth »

yep, did this 2 minutes before your reply :D

All good using HOME=/root and setting USER=root in unit file.

Thanks :D
Post Reply