What I did was to create a bash shell script that runs all the commands that you are now running manually. Three things to know about shell scripts:
1. The first two lines should likely be this:
#!/bin/sh
cd ~/<directory where zap2xml is located>
2. If you have a program that will not run from within the shell script, make use you specify the full path and program name (which you can obtain using the which command). For example let's say you want to create text file containing the date, so you can check to see when the script last ran. Ordinarily you might do this:
date > lastrun.txt
But it may not work in a shell script because you aren't using the full path, so you'd execute "which date" from the command line, which will likely show you it's at /bin/date. So, you'd use this instead:
/bin/date > lastrun.txt
3. Make sure your shell script it executable, and owned by whichever user will be running it (you, or hts or whatever).
Just put whatever you are doing manually into the shell script, then try running the shell script manually and make sure it does everything it's supposed to do.
Now, the cron job thing in TVHeadend is only for telling TVheadend when to read the contents of the tv_grab_file.xmltv file. What you need to do is create a Linux cron job to run your batch file once a day. Now I can't tell you exactly how to do that because I always install Webmin on my servers and use that to do a lot of Linux-y tasks that I wouldn't otherwise know how to do. In Webmin I just created a scheduled cron job to run once a day in the early AM hours. In order to be nice to the servers I pick a random oddball time, not on an hour or half-hour mark. So let's say you create a cron job to run your shell script at 4:37 AM each morning (pick some other random time, please). Remember you must specify the full path to your shell script and also be aware of which user is running the cron job - if you want the tv_grab_file.xmltv file to be readable by TVHeadend then you want to run the cron job as the TVHeadend user (probably hts). Webmin lets you specify the user when you create a cron job but I suppose you could also change users from the command line (using "sudo su hts" for example) and then maybe set up your cron job using "crontab -e" (?).
Anyway, assuming you have set up your cron job to do this and everything seems to be working (it is creating a new tv_grab_file.xmltv file each day) then the only remaining thing to do is set the "Cron multi-line" field in the Internal grabber section. I usually give the shell script ten minutes to do its thing (normally it takes less than a minute, so ten minutes should be plenty unless you are importing a HUGE channel list) so continuing with this example, if you have the cron job run the shell script at 4:37, then you'd let TVHeadend import it at 4:47, by putting this in the "Cron multi-line" field (after erasing any default settings there):
47 4
To be clear, your LINUX cron job creates the day's new tv_grab_file.xmltv at 4:37 AM, and then at 4:47 AM TVheadend imports it into its database (again, please* pick random oddball times so that everyone isn't trying to access the servers at once).
If anything appears to not work, check permissions and ownership, and check that you have specified full paths, particularly in your cron job setup. Cron jobs appear to be particularly dumb about paths so you have to give them full paths to everything, or they can't find anything. A bash script that works fine when you run it as a user will often fail when run as a cron job if full paths aren't specified. Sorry if I am telling you stuff you already know, but I banged my head against the desk several time trying to figure out why this wouldn't work at first, and it all came down to not specifying full paths. Hope this helps.
By the way, I would be remiss if I did not point out that there is supposed to be another way to do this, using xmltv.sock. As with so many things about TVHeadend this is rather poorly documented (in any manner that a typical user can understand); there is a thread about it on the Kodi forum at
http://forum.kodi.tv/showthread.php?tid=216393 but even after reading that I am not at all sure how you'd use it in practice. So, I just stick to what I know works!
<<