Automatic update when USB is plugging

I have idea, but only idea.
What I want? Automatic update of config files OH in RPi when USB is plugging.
My idea:

  1. Plug USB
  2. RPi automatic read USB
  3. When RPi find on USB key folder with name OPENHAB_UPDATE
    a) automatic compress old config files in RPi to the file with name and copy to selected folder
    b) then copy files from USB key to config folder

Would anyone do something like that?Please.

What is wrong with

apt-get upgrade openhab2

Or the upgrade scripts built into openHABian?

Sorry, I need update only config files because I have installed OH at home on machine,I’m making changes there and I need update without PC.

You can BackUp the “Old” Files with the BackUp Tutorial and than sync the new files with rsync. When you don’t like to do this manually, you can write a BashScript for this Commands. If you want start the Script at Mounting the USB Stick, you can use UDEV … Read the MAN Page for UDEV :slight_smile:

Take care and test this first in a Test System :slight_smile:

I have BashScript,that works fine when I run manually but I have problem with UDEV, I dont know how to detect idVendor and idProduct of USB (I know lsusb) and thet write it to UDEV.

udevadm info -a -p $(udevadm info -q path -n /dev/ttyACM0)