Need help how to run some linux housekeeping commands

Hello, i’m just looking for a pointer to some info and advice on approach.

What could i use to run some linux commands on my system periodically?

Such as a little housekeeping, deleting logfiles from other programs etc…

what would be the best way to approach it?

Also some way to display statistics about my system would be nice, disk usage etc…

Thanks for any suggestions, the simpler the better!!!

I use for that the exec-binding and call python-programs.

That sounds like what i need,
Could you share an example script/program and the method used to call it from exec to get me started?

https://docs.openhab.org/addons/bindings/exec/readme.html

I personally would not recommend using exec binding for this sort of thing. In order for it to work you either need to run OH as root or you need to give it permissions to run commands as root at which point the impact of a compromised OH or an OH run amock is much higher.

For log files, most programs should rotate their logs on their own automatically anyway. If they don’t, then you can drop a shell script into cron.daily or cron.weekly or cron.monthly and that script will automatically be executed at that frequency.

How do you want to see your statistics?

If you want them in your sitemap then SNMP binding or Sysinfo bindings or exec binding to run scripts which can put that information into Items for display on your sitemap/HABPanel.

If you want something when you log in look at FireMotD which is what openHABian uses.

1 Like