Page 1 of 1

License not working when script called by crontab

Posted: 29 Aug 2019, 12:17
by phibins
I have a python script that downloads some files from the internet.

Code: Select all

/media/full/path/myscript.py
In that script, if the condition are met the filebot command line is executed through a system call and renames the files.

This script works with no issue when I call it through the terminal. But for some reason when called through the

Code: Select all

crontab
(Cron job) Filebot fails to find my license.


The Filebot script that is called (I'm sure the script is good, because it works when the license is found)

Code: Select all

FILEBOTSCRIPT="filebot -script fn:amc --log INFO --output \"" + outDir + "\" --action move --conflict auto -non-strict \"" + inDir + "\" --filter \"(n != \'American Dad!\' || s == 16)\" --log-file amc.log --def clean=y music=y subtitles=en musicFormat=\"{plex}\" movieFormat=\"{plex}\" seriesFormat=\"{plex}\" minFileSize=4"
    print('Called Filebot command')
    return os.system(FILEBOTSCRIPT)
This is what the logfile outputs looks like when called through the terminal:

https://i.imgur.com/J7VLAR5.png

Called through the crontab command (license fails):

https://i.imgur.com/5ulsqaY.png

Any advice welcomed. Ty.

Re: License not working when script called by crontab

Posted: 29 Aug 2019, 12:37
by rednoah
Your unattended crontab task is running as root. Living dangerously, are we? :o

You'll want to run your crontab tasks with your user, so that the context in which you are testing your crontab task is the same as the actual context in which the crontab task will be executed by cron.

:arrow: https://www.google.com/search?q=how+to+ ... gular+user

Re: License not working when script called by crontab

Posted: 19 Sep 2019, 13:00
by phibins
Thank you rednoah, your hint that i was running the task as root led me to learn a thing or two about linux.

I've moved my crontAB TASKS TO the normal user.

Big fan of the software. Thanks!