I have, roughtly speaking, something like this:
#1
cmd="
set -e
MIX_ENV=prod \
mix local.hex --force
MIX_ENV=prod \
mix deps.get --only prod
MIX_ENV=prod \
mix compile
MIX_ENV=prod
mix release --overwrite
"
ssh -t -A -q -C \
-o ConnectTimeout=300 \
-o ServerAliveCountMax=5 \
-o ServerAliveInterval=30 \
"$USER@$HOST" "$cmd" || error "\nA remote command failed on: $HOST"
It’ll disconnect after each mix <command>
- I tried to comment out each one, one by one. And sometimes it’ll work, but rarely.
Whereas this works
cmd1="
set -e
MIX_ENV=prod \
mix local.hex --force
"
ssh -t -A -q -C \
-o ConnectTimeout=300 \
-o ServerAliveCountMax=5 \
-o ServerAliveInterval=30 \
"$USER@$HOST" "$cmd1" || error "\nA remote command failed on: $HOST"
cmd2="
set -e
MIX_ENV=prod \
mix deps.get --only prod
"
ssh -t -A -q -C \
-o ConnectTimeout=300 \
-o ServerAliveCountMax=5 \
-o ServerAliveInterval=30 \
"$USER@$HOST" "$cmd2" || error "\nA remote command failed on: $HOST"
# and so on
but isn’t optimal.
It’s as if mix <command>
made the shell disconnect somehow. Or as it was too long for a simple ssh session.
What’s the matter?