Cron / Periodic

What’s the easiest way to run a cron / schedule task on Hass.io?
I tried crontab but it was reset to the /etc/periodic entries.
Then I tried putting the script (tested with run-parts and working fine) inside /etc/periodic/hourly but it’s not being run either.
I’m trying to run a curl command to update my dynamic dns IP …

check this page to get started.
Once you’ve got your trigger sorted, you can look into an action to perform, i.e. call your script. I’m guessing it’ll be shell_command?

2 Likes

@lolouk44 Thanks. That’ll get me going at least for this purpose.

But I would very much prefer cron. Overall I find hass.io very limiting and unstable so much go back to Hassbian.

1 Like

np. I’m not using hass.io, just a reguler HA on Ubuntu…

Hello,
I can not use the terminal (shell) properly to create a cron
let me explain:
in general we can do sudo apt-get install “name of soft”
=> -bash: apt-get: command not found
with the latest version I can not
I have the impression that the latest version of Hassio’s bridles
is this correct? otherwise how to do

I don’t believe you can do apt-get install under hass.io as it’s not designed for that purpose. Hass.io is designed to “only” run an HA instance without having to worry about the maintenance part. You can add add-ons if you fancy, but that’s as far as it’s designed to be
It looks like you’re an intermediate to advanced linux user want to do more than just HA and as such maybe
you should indeed think about going to a regular HA install.

Coming back to your initial question though, why not use an automation to trigger an action? What are you trying to schedule? If it’s just a python script, you could simply have an automation that runs as and when you want it and triggers a script via a shell_command? What is it that cron does that you can’t achieve with an automation?

thanks for this information as well as the quick response
I would like to launch add-ons at the start of Hassio.
Despite that I check the option Start on boot (for example spotify) but does not start after a restart Hassio.
that’s why I want to force the start of a service or an add-on with cron.
if you have a solution for this kind of problem, I am a taker
Cordially
Fams

Sorry mate, I’ve never actually tried hass.io and only tried to help from a standard HA config point of view, Maybe someone else can help?

Does anyone know the answer to the original question as to why scripts put into e.g. /etc/periodic/hourly do not run?

I’m trying this as well. I see that the script put there wont run even with the right permissions.
#!/bin/bash seems to be a no no in here also

FWIW, Hass.io does not (seem to) ship with Bash - it uses Ash - so specifying Bash as the script interpreter is a non-starter.

Would hazard to say, look in the logs to confirm that a run of the script was attempted and failed.

i know this is an old one, but how would i do a http call say every 10 sec?

i get the trigger part, that is easy, but how to i make a http request every 10 sec?

i want to send data from sensors etc to an self hosted data collection system

/input/post?node=1&csv=100,200,300&apikey=xxxxxxxxxxxxxxxxxxxxxxxxxxxx

of course the values 100, 200 and 300 needs to be replaced with values from entities

sorry if this i well documented, but i’m not the sharpest knife when it comes to searching forums and google is not any better