I am running OSX Mountain Lion and the remote server is CentOS 6. I have several scripts on my local machine that I want to run on the remote server and to that end, I thought to write one script that connects via ssh that takes a the a second script to execute as a parameter. This way, I can write bash scripts naturally without having to worry about ssh and all the concerns that come with that, and the same scripts would also be able to be repurposed on my local machine. For instance,
!#/bin/bash ssh -t -t jeff@remoteserver 'bash -s' < $1
make_dir.sh (note the sudo)
!#/bin/bash sudo mkdir -p /some/path/to/a/new/location
And the idea being to run as
I've run into many problems, most of which I have been able overcome. However, now when I execute the scripts as above, the terminal hangs for several minutes, the remote directory is not created and there is no error message.
Moreover, since I haven't called
logout, I still have the ssh terminal open and all subsequent commands (i.e.
ls) are completely frozen. I let an
ls run for an 70 minutes before breaking it. Note: I dont actually care about running commands afterwards; I merely include this as a symptom of what is wrong.
How do I correct this? Or better yet, is there a better way to approach this problem?
If I update my
make_dir.sh script to create a directory that doesnt require
sudo, the script executes perfectly normally, as expected. Is there a known issue with running sudo commands remotely? Perhaps just with CentOS?