I have multiple pi's running a program where they listen for a broadcast message and trigger a python script.
My python script that's triggered has config details that is same for all pi's.
Whenever I update any config option. I am reinstalling in all the pi's.
I am sure there is a more efficient way to do this. I am relatively new.. could you please direct how I can have a config file on network and share with all pi's.
Thanks
-
1Anyone of the many suggestions should help you. Please accept one answer or make your own answer to finish your question so it will not pop up year for year.Ingo– Ingo2019年11月04日 11:48:39 +00:00Commented Nov 4, 2019 at 11:48
2 Answers 2
Your options are nearly limitless here:
put the config file on a server and write a script which downloads it to the RPi when it boots up. Install the update script on each RPi
put the config file on a server and modify your original script to use the config file directly from the server
put the config file on a network drive and mount the drive on each RPi on boot
create a custom package repo and put your config file in a package. Run
apt-get update; apt-get upgrade
on each RPi to update the configconfigure passwordless SSH on your RPis and write a script which pushes the config file to all RPis from your PC
configure a sync'd folder on each RPi with
rsync
or similar, and save the config file therebroadcast the config file in the wake-up message
the list goes on.
You can use a network share for example made with NFS (network file system) or with Samba (MS windows like network share). Then you can make a symbolic link to the config file on the network share. I know that it is working with the Unix specific NFS. I don't know if symlink to a Samba share also works but it should. For example if you have a NFS share mounted to /mnt/server/
that contains the central config file then you can symlink to it:
rpi ~$ ln -s /mnt/server/config.py config.py
Now you can use config.py
like a normal local file.