नीचे स्क्रिप्ट है।
मैं कई सर्वरों को लॉगिन करना चाहता था और कर्नेल संस्करण की जांच करना चाहता था।
#!/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
मुझे उम्मीद है कि आउटपुट जो पसंद आएगा ..
server1_hostname
kernel_version
server2_hostname
kernel_version
और इसी तरह..
मैंने इस स्क्रिप्ट को Server.txt में लगभग 80 सर्वरों के साथ चलाया
और मुझे जो आउटपुट मिला वो था .....
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.
यहाँ मुझे केवल 1 होस्ट के लिए आउटपुट मिला, जो है xxxxdev01
और वह भी ssh बैनर और अन्य चेतावनी के साथ आता है।
मुझे अन्य सभी मेजबानों और बिना ssh बैनर के आउटपुट की आवश्यकता है .. यहाँ क्या गलत हो रहा है?
ssh -t -t root@
... एक छद्म टर्मिनल को मजबूर करने के लिए।
sshpass -p password root@server histname
?