![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Bash Script to check Remote Host Connection | zulfikarmd | UNIX for Dummies Questions & Answers | 5 | 04-16-2008 06:53 AM |
| How to delete the files from local host to remote host | krishna176 | SUN Solaris | 3 | 03-24-2007 04:48 PM |
| FTP - Connection Closed By Remote Host | mouglybean | IP Networking | 1 | 10-26-2004 09:15 AM |
| Connection to host lost | goose | UNIX for Dummies Questions & Answers | 2 | 06-04-2002 07:32 PM |
| connection to host lost | nbiketi | UNIX for Dummies Questions & Answers | 1 | 04-25-2001 11:45 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Of course, that's a Useless Use of Test $?
Code:
ssh $host "echo 2>&1" && echo $host OK || echo $host NOK |
|
||||
|
I got a problem here
I removed the public key config on the ssh server and then tried ssh root@$host "echo 2>&1" && echo "OK" || echo "NOK" But it came out asking password . which I dont want , what I wanted is even if its asked passwd its should come out with a non-zero exit satus. -------------------------------------------------------------------- Now let say how I got it implemented , even though a twisted way if [ -f $HOME/.ssh2/ssh2_config ] then mv $HOME/.ssh2/ssh2_config $HOME/.ssh2/ssh2_config.bkp echo "QuietMode yes\nBatchMode yes\nConnectTimeout 4" > $HOME/.ssh2/ssh2_config else echo "QuietMode yes\nBatchMode yes\nConnectTimeout 4" > $HOME/.ssh2/ssh2_config fi ssh -l root $R_HOSTNAME "date" > /dev/null CONN_STATUS=$? And if the RC is 66 , then it mean it had asked passwd and not got passwd within in the timeout period. Andas usual 0 as success. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|