1

I'm writing a script which is meant to initially set up my Droplet. In the script, I'm opening ssh connection with my Ubuntu 14.04 server as follows (with USER and REMOTE variables previously defined):

ssh -t -t $USER@$REMOTE <<'ENDSSH'
ENDSSH

Inside of that SSH connection, I have multiple commands which I want to execute - installing Node.js, updating npm, installing MongoDB and so on.

But, once I do a apt-get install command, other commands do not get executed.

So, if I have this:

ssh -t -t $USER@$REMOTE <<'ENDSSH'
sudo apt-get update
sudo apt-get install -y nodejs
sudo apt-get install -y npm
ENDSSH

Command sudo apt-get install -y npm won't be executed. Now, I know that I can install multiple packages within the same apt-get install command, but this is not what I'm asking, since other commands afterwards won't get executed than. This example I just wrote out of simplicity so I can explain my problem.

I came across questions like this one where they say I should put multiple -t flags when opening ssh connection, which I'm doing, but that doesn't help.

What am I doing wrong?

Tommz
  • 111
  • 1

0 Answers0