Start Cron Job once Kodi has started

Hi there, Can someone help me find the right way to launch a script once Kodi has started? I’d been looking at cron but suspect I need to be looking at upstart or something like that?

You can use Kodi’s autoexec.py

Cheers, I used the autoexec.py to do a bash call, that made it work!

Out of interest, will that script only fire after auto mounting of USB drives etc.?

The script runs as soon as Kodi launches. udisks-glue is launched independently and does not depend on Kodi and Kodi does not depend on udisks-glue. Therefore it can in theory, be racy, but more often than not you will be OK.

If you want to truly be safe, wait for udevadm settle to finish

Sam

Will take a look once I’ve finished up triggering library updates, thanks!

Wait, you want to trigger library updates on start-up?

Yes, after a rsync from a nfs share has completed. I’m aware of the built in setting but this fires independently of my rsync

Cant rsync call a script once it is finished?

A simple http request like this causes a library scan:
http://192.168.1.101/jsonrpc?request={"jsonrpc":"2.0","method":"VideoLibrary.Scan"}

I went with kodi-send in the end, and have since built a simple add-on to call the bash script so there’s a UI trigger, as well as the on boot run, and cron scheduled runs. Thanks all for the help!