Tools for restart / clear cache etc

Hello All,

I created some simple tools for restarting openhab and clearing the cache.

There is:

ohstop --> stops openhab
ohstart --> restarts / starts openhab
ohtail --> restarts openhab and tails openhab.log
ohtailcc --> restarts openhab, clears cache, and tails openhab.log
ohrebootcc --> stops openhab, clears cache, and reboots system.

These have only been tested on openhabian, but should work on most linux as long as openhab is in the standard path. Future changes could include use of environment variables if necessary.

To install follow the readme, but basically clone my repository and run the oh install script.

Have a look and provide feedback. The link is:https://github.com/thedannymullen/OHtools/blob/master/README.md

2 Likes

Hi @Thedannymullen,

Did you know that openHAB’s apt (and therefore openHABian) and RPM packages come with commands already? They should be on your server too:

openhab-cli --help

Usage:  openhab-cli command [options]

Possible commands:
  backup [filename]   -- Stores the current configuration of openHAB.
  clean-cache         -- Cleans the openHAB temporary folders.
  console             -- Opens the openHAB console.
  info                -- Displays distribution information.
  reset-ownership     -- Gives openHAB control of its own directories.
  restore filename    -- Restores the openHAB configuration from a backup.
  showlogs            -- Displays the log messages of openHAB.
  start [--debug]     -- Starts openHAB in the terminal.
  status              -- Checks to see if openHAB is running.
  stop                -- Stops any running instance of openHAB.

That said, the start and restart commands in these scripts do not use the service file, only start a manual instance while hinting that systemctl should be used.

3 Likes

Yes, I get this when I type it:

A systemd service configuration exists…
Use ‘sudo /bin/systemctl stop openhab2.service’ to stop an openHAB service
Stopping any instance of openHAB…

When I asked for status it did not return one.

Thanks for sharing this! Simple, yet handy tools.

Cheers!

Can also be found in the docs :sunglasses:

1 Like

This broke the Openhab2.5 manual install set up.