7

I have a bash script, which im using on a handful machines. On all machines, its the same script. Sometimes i need to adjust/update the script. With that, i need to copy the script to all this machines again.

Is there some way to update the script only on one central location and if this is done, the script checks itself, if there is a updated/changed variant on this central location and if so, copy the new version and restart itself after copy?

you are viewing a single comment's thread
view the rest of the comments
[-] MoLoPoLY@discuss.tchncs.de 1 points 17 hours ago

Syncthing is blocked, or better the ports are blocked on 3 of the hosts (and i cant open them). I can use scp, to copy files. Ports 22 and 443 are the only ports, i can use on all hosts. Additionally, i cant install new software there.

For the restart, i have found the line exec "$(realpath $0)" "$@". Using the script directly works with that. But since the script is called from a systemd service unit, i don't know if this break the logic. The service unit is from type oneshot and calls the script multiple times (but different parameters), like this:

ExecStart=/home/username/.local/bin/script.sh variant1
ExecStart=/home/username/.local/bin/script.sh variant2
ExecStart=/home/username/.local/bin/script.sh variant3

script.sh does different things, when changing the first parameter. It starts the other variants, when the current variant finishes. Now i don't know, if restarting /home/username/.local/bin/script.sh variant1 will break the logic and the other variants will either not executed or in some unexpected schedule.

this post was submitted on 07 Jun 2026
7 points (100.0% liked)

Linux Questions

3943 readers
28 users here now

Linux questions Rules (in addition of the Lemmy.zip rules)

Tips for giving and receiving help

Any rule violations will result in disciplinary actions

founded 2 years ago
MODERATORS