I am running Cent OS 7 and trying to invoke a perl script to update Over the Air TV Guide data to XML for my Plex media server.
The problem is that Cron doesn't run the script.
If I run the script in the shell, it runs fine with the command:
/usr/bin/perl /home/Media/Misc/TVXML/hr_epg.pl > /home/Media/Misc/TVXML/test.xml
If I run it via cron (every minute just to test):
* * * * * /usr/bin/perl /home/Media/Misc/TVXML/hr_epg.pl > /home/Media/Misc/TVXML/test.xml
Nothing happens.
So If I run cron with:
* * * * * /usr/bin/perl /home/Media/Misc/TVXML/hr_epg.pl > /home/Media/Misc/TVXML/test.xml var1 var2 &>>/home/Media/Misc/TVXML/cron.log
and the export of cron.log:
Can't locate JSON.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /home/Me$ BEGIN failed--compilation aborted at /home/Media/Misc/TVXML/hr_epg.pl line 4.
Line 4 is: use JSON;
Perl check:
perl -E'say $^X' /usr/bin/perl
cpan JSON:
cpan JSON Reading '/root/.cpan/Metadata' Database was generated on Sat, 29 Jun 2019 00:55:31 GMT Fetching with LWP: http://mirrors.namecheap.com/CPAN/authors/01mailrc.txt.gz Reading '/root/.cpan/sources/authors/01mailrc.txt.gz' ............................................................................DONE Fetching with LWP: http://mirrors.namecheap.com/CPAN/modules/02packages.details.txt.gz Reading '/root/.cpan/sources/modules/02packages.details.txt.gz' Database was generated on Sun, 30 Jun 2019 01:56:15 GMT ............. New CPAN.pm version (v2.26) available. [Currently running version is v1.9800] You might want to try install CPAN reload cpan to both upgrade CPAN.pm and run the new version without leaving the current session.
...............................................................DONE Fetching with LWP: http://mirrors.namecheap.com/CPAN/modules/03modlist.data.gz Reading '/root/.cpan/sources/modules/03modlist.data.gz' DONE Writing /root/.cpan/Metadata JSON is up to date (4.02).
If somebody can give me some assistance as JSON is there and this script does run via CLI, that would be great.
Thank you