7
Update and restart bash script after updating itself?
(discuss.tchncs.de)
Linux questions Rules (in addition of the Lemmy.zip rules)
Tips for giving and receiving help
Any rule violations will result in disciplinary actions
Syncthing helps with syncing the bash script across all of your devices. However, as for restarting itself after the update/change, you might want to setup a daemon/service (or something) that restarts the bash script whenever Syncthing does its bidding.
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: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 variant1will break the logic and the other variants will either not executed or in some unexpected schedule.