License not working when script called by crontab

Support for Ubuntu and other Desktop Linux distributions
Post Reply
phibins
Posts: 22
Joined: 28 Mar 2018, 02:49

License not working when script called by crontab

Post 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.
User avatar
rednoah
The Source
Posts: 22976
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: License not working when script called by crontab

Post 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
:idea: Please read the FAQ and How to Request Help.
phibins
Posts: 22
Joined: 28 Mar 2018, 02:49

Re: License not working when script called by crontab

Post 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!
Post Reply