26 lines
997 B
Bash
Executable file
26 lines
997 B
Bash
Executable file
#!/bin/bash
|
|
|
|
set -Eeuxo pipefail
|
|
|
|
for HOST in "$@"; do
|
|
# copy files to target server
|
|
scp ./unhinged-traefik-announcer ${HOST}:unhinged-traefik-announcer.tmp
|
|
scp ./unhinged-traefik-announcer.service ${HOST}:unhinged-traefik-announcer.service.tmp
|
|
# set permissions of files on remote server
|
|
ssh ${HOST} chmod 755 unhinged-traefik-announcer.tmp
|
|
ssh ${HOST} chmod 644 unhinged-traefik-announcer.service.tmp
|
|
# update the unit and reload systemd
|
|
ssh ${HOST} mv unhinged-traefik-announcer.service.tmp unhinged-traefik-announcer.service
|
|
ssh ${HOST} systemctl daemon-reload
|
|
# restart the service after updating the binary
|
|
ssh ${HOST} systemctl stop unhinged-traefik-announcer
|
|
ssh ${HOST} mv unhinged-traefik-announcer.tmp /usr/local/bin/unhinged-traefik-announcer
|
|
ssh ${HOST} systemctl enable unhinged-traefik-announcer
|
|
ssh ${HOST} systemctl start unhinged-traefik-announcer
|
|
# make sure things are ok
|
|
sleep 1
|
|
ssh ${HOST} systemctl status unhinged-traefik-announcer
|
|
done
|
|
|
|
|