[mythtvnz] cron.daily mythfilldatabase environment issue
Tony Sauri
hoiho.nz at gmail.com
Thu Sep 10 09:58:11 BST 2015
On 10/09/15 20:47, Daniel Hughes wrote:
> I have been trying to setup a daily cron job to udpate my listings
> from http://epg.org.nz/freeview.xml.gz
>
> My script runs fine if I run in manually but it fails when run from
> cron with these errors:
>
> 2015-09-10 07:55:52.485142 W This application expects to be running a
> locale that specifies a UTF-8 codeset, and many features may behave
> improperly with your current language settings. Please set the LC_ALL
> or LC_CTYPE, and LANG variable(s) in the environment in which this
> program is executed to include a UTF-8 codeset (such as
> 'en_US.UTF-8').
> 2015-09-10 07:55:52.485154 W Cannot locate your home directory.
> Please set the environment variable HOME
> 2015-09-10 07:55:52.485158 E Failed to init MythContext, exiting.
>
> Here is my script:
> #! /bin/bash
> echo "$(date) : starting epg import " >> /tmp/epggrubber.log
> PATH=/usr/sbin:/usr/bin:/sbin:/bin
> HOME=/home/mythtv
> LANGUAGE=en_NZ:en
> LANG=en_NZ.UTF-8
> wget -O /tmp/freeview.xml.gz http://epg.org.nz/freeview.xml.gz >>
> /tmp/epggrubber.log 2>&1
> gunzip /tmp/freeview.xml.gz >> /tmp/epggrubber.log 2>&1
> mythfilldatabase --update --file --sourceid 2 --xmlfile
> /tmp/freeview.xml --update >> /tmp/epggrubber.log 2>&1
> rm /tmp/freeview.xml
> echo "$(date) : finished epg import " >> /tmp/epggrubber.log
> exit
>
> As you can see I am setting the environment variables for home and language.
>
> Anyone know what I need to do to make it work?
>
> Cheers,
> Daniel Hughes
>
> _______________________________________________
> mythtvnz mailing list
> mythtvnz at lists.linuxnut.co.nz
> http://lists.ourshack.com/mailman/listinfo/mythtvnz
> Archives http://www.gossamer-threads.com/lists/mythtv/mythtvnz/
>
When run by/from cron there is no environment available. You have set
some variables but not added them to the environment.
You need an export statement just prior to your wget statement.
Tony Sauri
More information about the mythtvnz
mailing list