Run shell script that takes to finish more than 60s

I’ve read here that one can only run scripts that take no more than 60s to finish.

What’s the workaround?

What I’ve tried:

  • use Python Scripts to execute shell commands in subprocess, but this isn’t doable, I cannot import modules
  • use crontab after SSH-ing onto my HAOS box, using the Advanced SSH Terminal addon, but crontab does not seem to execute things, also I read crontab doesn’t persist there :S

Anything simple? Like running something like mtr -r -c 100 example.com for diagnostics. I could lower here 100 to 10, just used as an example.

So my question is how to best overcome the timeout limitation, not about how to actually run things. Given clear pointers I can manage that.

Thanks for the input.

X-Y problem.

What are you trying to do with the shell command?

If you background, nohup and redirect all (3) standard channels to /dev/null it will work.

But as tom_I points out you are Off-piste here, if you need to control a long running process you would be better off with something like an MQTT integration where you control the long running job via events.

Run something, that might take 61s, but not 120s, usually. One off things when I SSH onto my box, etc. But would like to persist over reboots probably.

Hmm, nohup, haven’t used that in a while I totally forgot about it. Will check it out.

I think my best shot is to bootstrap cron to start with the Advanced SSH docker container. Starting cron and putting my stuff into /etc/periodic worked, but will break on restarts.

What something?

What things?

Give concrete examples. Otherwise all I can say is that the hammer you have chosen to drive in that screw is the wrong tool.

1 Like

Point taken. :+1:
I don’t have concrete a example, just wanted to know the possibilities.