Execute openhab-cli clean-cache without interactions

I have ol 2.4 version and sometime a clear cache is needed. I would like to automate, but command

openhab-cli clean-cache

require confirmation, pressing y before execution.
Is there a way to suppress prompt and execute a clear cache in batch?

Many Thanks

yes | openhab-cli clean-cache

But you shouldn’t need to clear the cache in operations, only maybe after adding bindings (which you should not be doing all day, should you)

ho @mstormi
i have to reboot my Debian Box with opehab every 3/5 days, otherwise it hang and then I have to reboot manually. To do this I did a cron job that reboot every 3 days my debian box. After one month and half, after reboot, openhab start but with a lot of issue. No PaperUI, WebUI without some data, MQTT server hang. Only way to fix this is to stop OH, clean cache and restart, and this fix. Someone here a couple of year ago suggested me this procedure to clean cache. For this reason I need to automate. Is there a way to Automate?


Re-read 1st line of my post ?

Any properly setup OH installation has no need to be rebooted.
So go debug your issues instead of fighting them by reboots, that is no fix.
Upgrade to latest 2.X (2.5.12 I think it is).

PS: you made us victim to the XY problem, see #8 in How to ask a good question / Help Us Help You

I’m moving to 3.x, so make no sense to upgrate to 2.5. Moving will take mo lots of time, also because OH control may heater and now where I live, heater is needed. For this reason I would like to keep my 2.4 until next sping.
If there is no way to perform a clean cache automatically, i perform it manually untile 3.x will be live.


Did you try what Markus suggested ?
The command Markus suggested can be used in a batch/shell script.

Oh sorry I miss Markus 1st line of his post.