#!/bin/bash set -uo pipefail out=$(ssh mastodon@abraham.jeena.net "bash -euo pipefail upgrade.sh $2 2>&1 | tail -5; exit \${PIPESTATUS[0]}") status=$? # Report the last lines either way so notifications show what happened. if [ -n "$out" ]; then echo "$out" elif [ "$status" -ne 0 ]; then echo "Update script exited with status $status" fi # Propagate the upgrade.sh exit status, not tail's. exit "$status"