The problem is with a Debian Jessie server.
I run a remote command with ssh like the following example.
#! /bin/bash
ssh root@srv01 << 'STOP_SERVER'
touch /tmp/testFile
STOP_SERVER
This works except that I get a lot of output that I don’t want. Here is an example with sensible information replaced by stars.
root@home:~# ./test.sh
Pseudo-terminal will not be allocated because stdin is not a terminal.
Linux srv01.***.*** 3.14.32-xxxx-grs-ipv6-64 #5 SMP Wed Sep 9 17:24:34 CEST 2015 x86_64 GNU/Linux
server : ***
ip : ***
hostname : srv01.***.***
stdin: is not a tty
If I change the script to the following
#! /bin/bash
ssh root@srv01 << 'STOP_SERVER' >> /dev/null
touch /tmp/testFile
STOP_SERVER
I get the following output
root@home:~# ./test.sh
Pseudo-terminal will not be allocated because stdin is not a terminal.
stdin: is not a tty
If I add the option -q to the ssh command I get
root@home:~# ./test.sh
stdin: is not a tty
And this is where I’m stuck because I don’t know how to rewove stdin: is not a tty.
I wish I could avoid output redirect to /dev/null. It’s just the login messages that I don’t want to see.
ssh -t?