-
-
Save CamDavidsonPilon/e6e55a5ab0a7a3e732fb95962e863c84 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -x | |
set -e | |
export LC_ALL=C | |
PIO_DIR=/home/pioreactor/.pioreactor | |
# Get the hostname | |
HOSTNAME=$(hostname) | |
# Get the leader address | |
LEADER_HOSTNAME=$(crudini --get $PIO_DIR/config.ini cluster.topology leader_hostname) | |
if [ "$HOSTNAME" = "$LEADER_HOSTNAME" ]; then | |
#### Fix issue with `pio log` commands in systemd services failing | |
# List of systemd files | |
systemd_files=("/lib/systemd/system/avahi_aliases.service" "/lib/systemd/system/load_rp2040.service") | |
# Loop through each file and add 'User=pioreactor' and 'EnvironmentFile=/etc/environment' under '[Service]' if they don't already exist | |
for file in "${systemd_files[@]}"; do | |
sudo crudini --ini-options=nospace --set "$file" Service User pioreactor \ | |
--set "$file" Service EnvironmentFile "/etc/environment" | |
done | |
sudo systemctl daemon-reload | |
sudo systemctl restart avahi_aliases.service | |
sudo systemctl restart load_rp2040.service | |
### update add_new_pioreactor_worker_from_leader to use pio workers discover | |
FILE_PATH="/usr/local/bin/add_new_pioreactor_worker_from_leader.sh" | |
sudo sed -i 's/pio discover-workers/pio workers discover/g' "$FILE_PATH" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment