Commit 7174c803 by Rinat K. Nugaev

Added some debug options when ssh connection cannot be established

parent 17997b19
...@@ -32,12 +32,13 @@ if [ -z "$user" ] ; then ...@@ -32,12 +32,13 @@ if [ -z "$user" ] ; then
echo "Username not defined in script, asking for username!" echo "Username not defined in script, asking for username!"
read -p "Enter your username like PertrovPP:" user read -p "Enter your username like PertrovPP:" user
#Cheking username for ssh connection and if good then add it to script variables #Cheking username for ssh connection and if good then add it to script variables
statusssh=$(ssh -o BatchMode=yes -o ConnectTimeout=5 -p 10022 $user@tunnel01.rbtechnologies.ru echo ok 2>&1) statusssh=$(ssh -v -o BatchMode=yes -o ConnectTimeout=5 -p 10022 $user@tunnel01.rbtechnologies.ru echo ok 2>&1)
if [[ $statusssh == ok ]] ; then if [[ $statusssh == ok ]] ; then
echo "Adding username $user for future use in the script" echo "Adding username $user for future use in the script"
sed -i -e '0,/user=""/s/user=""/user='$user'/' $0 sed -i -e '0,/user=""/s/user=""/user='$user'/' $0
else else
echo "Cant create ssh session with $user login! Exiting..." echo "Cant create ssh session with $user login! Exiting..."
echo $statusssh
exit 0 exit 0
fi fi
fi fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment