Hi,
I'm looking for help with a script I wrote that is being executed from a cron job. I use the ssh command to do a directory on a remote host and write it to a file on the host the script is running on. The command I use is:
ssh usename@remotehost "ls /dirname/*" >/dir_on_script_host/filename
The ssh command works fine and I always get my file on the script host, however sometime the command just does not end? Thus the script is stopped at that spot. I'm assuming there is some kind of race condition happening with what ssh is looking for to end the session. If I kill the ssh command left suspended on either the remote host or the script host all is find and the script keeps going.
I am going to try running the command in the background for now and just look for it to still be running after sometime and kill it if so but I really don't like this method and would like to do something cleaner.
Any ideas would be great thanks!
Kym
I'm looking for help with a script I wrote that is being executed from a cron job. I use the ssh command to do a directory on a remote host and write it to a file on the host the script is running on. The command I use is:
ssh usename@remotehost "ls /dirname/*" >/dir_on_script_host/filename
The ssh command works fine and I always get my file on the script host, however sometime the command just does not end? Thus the script is stopped at that spot. I'm assuming there is some kind of race condition happening with what ssh is looking for to end the session. If I kill the ssh command left suspended on either the remote host or the script host all is find and the script keeps going.
I am going to try running the command in the background for now and just look for it to still be running after sometime and kill it if so but I really don't like this method and would like to do something cleaner.
Any ideas would be great thanks!
Kym