Di bawah ini adalah skripnya.
Saya ingin masuk ke beberapa server dan memeriksa versi kernel.
#!/bin/bash
#input server names line by line in server.txt
cat server.txt | while read line
do
sshpass -p password ssh root@$line << EOF
hostname
uname -r
EOF
done
Saya akan mengharapkan output yang berjalan seperti ..
server1_hostname
kernel_version
server2_hostname
kernel_version
dan seterusnya..
Saya menjalankan skrip ini dengan sekitar 80 server di server.txt
Dan output yang saya dapatkan seperti .....
Pseudo-terminal will not be allocated because stdin is not a terminal.
Pseudo-terminal will not be allocated because stdin is not a terminal.
Pseudo-terminal will not be allocated because stdin is not a terminal.
Pseudo-terminal will not be allocated because stdin is not a terminal.
Pseudo-terminal will not be allocated because stdin is not a terminal.
Pseudo-terminal will not be allocated because stdin is not a terminal.
Pseudo-terminal will not be allocated because stdin is not a terminal.
Pseudo-terminal will not be allocated because stdin is not a terminal.
Pseudo-terminal will not be allocated because stdin is not a terminal.
========================================================================
================================ WARNING ===============================
========================================================================
This system is solely for the use of authorized personnel. Individuals
using this system are subject to having some or all of their activities
monitored and recorded. Anyone using this system expressly consents to
such monitoring and is advised that any unauthorized or improper use of
this system may result in disciplinary action up to and including
termination of employment. Violators may also be subject to civil and/or
criminal penalties.
========================================================================
Warning: no access to tty (Bad file descriptor).
Thus no job control in this shell.
xxxxdev01
2.6.32-431.23.3.el6.x86_64
Pseudo-terminal will not be allocated because stdin is not a terminal.
Pseudo-terminal will not be allocated because stdin is not a terminal.
Pseudo-terminal will not be allocated because stdin is not a terminal.
Pseudo-terminal will not be allocated because stdin is not a terminal.
Pseudo-terminal will not be allocated because stdin is not a terminal.
Di sini saya mendapatkan output hanya untuk 1 host, yang xxxxdev01
dan itu juga datang dengan spanduk ssh dan peringatan lainnya.
Saya perlu output dari semua host lain dan tanpa spanduk ssh .. Apa yang salah di sini?
ssh -t -t root@
... untuk memaksa terminal semu.
sshpass -p password root@server histname
?