RE: FW: SSH/SFTP rc problem in Solaris.
Just tried this on a Red Hat box (EL4). I get a return code of 0 for the same commands. We have a SSH return code problem when we use SSH in batch in Solaris. We haven't this problem on RedHat. bash-2.05$ cat a.sftp ls -l pwd get b.txt ls -l bash-2.05$ sftp -b a.sftp scnsys11 Connecting to scnsys11... Password: sftp ls -l drwxr-xr-x0 9108 10512 Apr 21 11:15 . drwxr-xr-x0 01 512 Apr 3 14:23 .. -rw---0 9108 10 2387 Apr 21 11:18 .bash_history -rw---0 9108 10240 Mar 28 16:19 .sh_history drwx--0 9108 10512 Mar 22 17:11 .ssh drwx--0 9108 10512 Mar 22 16:00 .ssh2 -rwxrwxrwx0 9108 10 26 Mar 29 15:22 a.sftp -rwxrwxrwx0 9108 10 0 Mar 28 15:28 a.txt -rw---0 9108 101021424 Mar 22 17:07 core sftp pwd Remote working directory: /export/home/huysego sftp get b.txt Couldn't stat remote file: No such file or directory File /export/home/huysego/b.txt not found. sftp ls -l drwxr-xr-x0 9108 10512 Apr 21 11:15 . drwxr-xr-x0 01 512 Apr 3 14:23 .. -rw---0 9108 10 2387 Apr 21 11:18 .bash_history -rw---0 9108 10240 Mar 28 16:19 .sh_history drwx--0 9108 10512 Mar 22 17:11 .ssh drwx--0 9108 10512 Mar 22 16:00 .ssh2 -rwxrwxrwx0 9108 10 26 Mar 29 15:22 a.sftp -rwxrwxrwx0 9108 10 0 Mar 28 15:28 a.txt -rw---0 9108 101021424 Mar 22 17:07 core sftp bash-2.05$ echo $? 0 ** As you can see in this example, sftp gives a rc = 0. If you try the same on RedHat, you will receive a rc not equal to 0.
when does ssh return?
I've looked through ssh man page and FAQ and tried a google search, but can't seem to figure out how to use ssh to start a command on a remote machine, have ssh exit immediately, and still have the command running on the remote machine. When I do [popcorn][~]$ time ssh [EMAIL PROTECTED] sleep 10 real0m10.216s user0m0.060s sys 0m0.000s ssh waits for the sleep to finish. Does anyone either understand why ssh is waiting for sleep to finish or how to make it not do it? I've tried ssh [EMAIL PROTECTED] run_and_return sleep 10 where run_and_return is the bash script: #!/bin/bash ?@ and a similar thing with a perl script that forks. I even tried having the perl script fork, have its child fork, and then the grandchild execute the command. But ssh keeps sticking around... Thanks for any help, Dave p.s. I'm using [popcorn][~]$ ssh -V OpenSSH_3.5p1, SSH protocols 1.5/2.0, OpenSSL 0x0090701f on [popcorn][~]$ uname -a Linux popcorn 2.4.20-6 #1 Thu Feb 27 10:01:19 EST 2003 i686 athlon i386 GNU/Linux with Fedora Core 2 installed.
Re: FW: SSH/SFTP rc problem in Solaris.
The second ls -l command successfully completes. Therefore the return code is zero. We have a SSH return code problem when we use SSH in batch in Solaris. We haven't this problem on RedHat. bash-2.05$ cat a.sftp ls -l pwd get b.txt ls -l bash-2.05$ sftp -b a.sftp scnsys11 Connecting to scnsys11... Password: sftp ls -l drwxr-xr-x0 9108 10512 Apr 21 11:15 . drwxr-xr-x0 01 512 Apr 3 14:23 .. -rw---0 9108 10 2387 Apr 21 11:18 .bash_history -rw---0 9108 10240 Mar 28 16:19 .sh_history drwx--0 9108 10512 Mar 22 17:11 .ssh drwx--0 9108 10512 Mar 22 16:00 .ssh2 -rwxrwxrwx0 9108 10 26 Mar 29 15:22 a.sftp -rwxrwxrwx0 9108 10 0 Mar 28 15:28 a.txt -rw---0 9108 101021424 Mar 22 17:07 core sftp pwd Remote working directory: /export/home/huysego sftp get b.txt Couldn't stat remote file: No such file or directory File /export/home/huysego/b.txt not found. sftp ls -l drwxr-xr-x0 9108 10512 Apr 21 11:15 . drwxr-xr-x0 01 512 Apr 3 14:23 .. -rw---0 9108 10 2387 Apr 21 11:18 .bash_history -rw---0 9108 10240 Mar 28 16:19 .sh_history drwx--0 9108 10512 Mar 22 17:11 .ssh drwx--0 9108 10512 Mar 22 16:00 .ssh2 -rwxrwxrwx0 9108 10 26 Mar 29 15:22 a.sftp -rwxrwxrwx0 9108 10 0 Mar 28 15:28 a.txt -rw---0 9108 101021424 Mar 22 17:07 core sftp bash-2.05$ echo $? 0 ** As you can see in this example, sftp gives a rc = 0. If you try the same on RedHat, you will receive a rc not equal to 0.