Colin Watson has proposed merging ~cjwatson/launchpad-bastion-scripts:run-action-restart-services into launchpad-bastion-scripts:main.
Commit message: run-action: Add convenience for restarting services Requested reviews: Launchpad code reviewers (launchpad-reviewers) For more details, see: https://code.launchpad.net/~cjwatson/launchpad-bastion-scripts/+git/launchpad-bastion-scripts/+merge/447998 Our service charms typically define `stop-services` and `start-services` actions where relevant. Add a `restart-services` form for convenience, which calls them both in sequence. -- Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad-bastion-scripts:run-action-restart-services into launchpad-bastion-scripts:main.
diff --git a/run-action b/run-action index c37b62d..73d6c15 100755 --- a/run-action +++ b/run-action @@ -18,4 +18,14 @@ case $unit in esac mkdir -p "$HOME/logs" -ssh -i ~/.ssh/id-run-action_ed25519 [email protected] "$unit" "$action" 2>&1 | tee -a "$HOME/logs/$(date +%F).log" + +run_action () { + ssh -i ~/.ssh/id-run-action_ed25519 [email protected] "$1" "$2" 2>&1 | tee -a "$HOME/logs/$(date +%F).log" +} + +if [ "$action" = restart-services ]; then + run_action "$unit" stop-services + run_action "$unit" start-services +else + run_action "$unit" "$action" +fi
_______________________________________________ Mailing list: https://launchpad.net/~launchpad-reviewers Post to : [email protected] Unsubscribe : https://launchpad.net/~launchpad-reviewers More help : https://help.launchpad.net/ListHelp

