In the most recently completed project, we used SSH remote login to the specified server. In command mode, we can directly use SSH + IP (by setting a password that does not require a user ), for example, ssh 10.22.19.54, use exit to exit the service on the local machine. To complete some automation work, I will implement this code using the following shell method:
G_log = "/home/admin/call. log"
G_var = $ *
SSH 10.22.19.54> $ g_log <EOF
Echo "I am 54 now ."
Echo "$ g_var"
/Home/admin // disp/ADB. Sh "$ g_var"
Exit
EOF
However, during debugging, we found a very depressing problem. After each script is called, the following error is reported:
Pseudo-terminal will not be allocated because stdin is not a terminal
TERM environment variable not set.
In addition, our scripts are called through java. After the Java thread is called, we find that the shell has not exited, causing the system resources to be occupied. In the case of a large number of users, the system will soon be unable to support it. This problem must be solved as soon as possible.
I searched the internet for a long time and found a lot of similar problems. After reading this, consult with our SA engineers. We recommend that you add a parameter-TT to try it. The result is displayed after a try, and the speed is very fast. Sure.
Summary. When a shell script calls SSH, you must add parameters to indicate that this is a script call.