2

I have a folder in the pi/home directory with python code. Is there a way to update (replace) these files by using one of the usb ports? I would like to be able to plug in the usb, reboot the pi, if there is a usb drive on boot, copy and replace the files in pi/home folder with the ones on the usb then automatically power back down.

1 Answer 1

1

Yes, you can.

First configure your Raspberry Pi to auto-mount USB Storage Devices (guide here).

Then create a script that checks the folders under /media/ where the mounted USB stick would be. If it finds your scripts, replace the old ones with the new ones.

Configure your script to run at boot by editing your /etc/rc.local (guide here)

1
  • Please take note that using /etc/rc.local has limitations due to Compatibility with SysV. We have seen many problems here on this site using it. Following the recommendation of the developers from systemd you should avoid using it.
    – Ingo
    Commented Jul 10, 2019 at 10:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.