How to add a custom cron?

Hello I do not understand this https://blog.linuxserver.io/2019/09/14/customizing-our-containers/

Could someone explain how I could make the following run in my tvheadend container please?

* * * * * echo "Hello" >> /config/hello.txt

Would this execute as the abc user or as root? Can I decide which?

Thanks,
Chris

Hello @Chris230291

I think it depends on the name of the file you place under /etc/crontabs :

  • every cron directive placed in /etc/crontabs/root will be run as root.
  • every cron directive placed in /etc/crontabs/abc will be run as user abc.

And so on

@Chris230291 : I’ve done several tests, and the only way to get it working was to put all cron directives into a file named /etc/crontabs/root owned by root user and root group, and with chmod 600 permissions.

Hope this helps.

I have a similar question:

I try to import the XML file for the EPG with the socket, my crontab is

root@ea6cc28881b6:/etc/crontabs#crontab -l
# do daily/weekly/monthly maintenance
# min   hour    day     month   weekday command
*/15    *       *       *       *       run-parts /etc/periodic/15min
0       *       *       *       *       run-parts /etc/periodic/hourly
0       2       *       *       *       run-parts /etc/periodic/daily
0       3       *       *       6       run-parts /etc/periodic/weekly
0       5       1       *       *       run-parts /etc/periodic/monthly
*/15 * * * * /usr/bin/curl -d @/config/zattoo_ch.xml -X POST -m 5 --unix-socket /config/epggrab/xmltv.sock http://127.0.0.1.com

But it does not push the file to TVHeadend. Where is the problem?