what this is doing is checking if a complete file is in an outbox, if so, ssh to a transfer server, executing a second ssh and checking if a file is 'not' present on the destination and if no, sending the files. I'm restricted to which ids and servers can be used, hence this convoluted method.
I'm getting a syntax error on the part where I'm checking if the file doesn't exist on the target.
ksh: syntax error at line 1: `[[' unmatched
Any ideas how to check this in an embedded ssh call?
Thanks in advance
---------- Post updated at 10:19 AM ---------- Previous update was at 10:13 AM ----------
doh... missed a space at the end before ]]
only when I posted it here was it obvious.
If you tunnel to this machine a lot, did you know you can setup ssh to do it for you.
So lets say this machine 10.0.0.1 is called saysdata.
If you put something like the below in your ~/.ssh/config file:
host fserver1
user transfer
IdentityFile ~/.ssh/transfer-key
host saysdata
user sftpin
IdentityFile ~/.ssh/sftp-key
ProxyCommand ssh fserver1 -W %h:%p
I haven't tried this with alternate identityfiles and this will require you to bring the sftp-key to your local machine. Perhaps someone with more experience in this area knows of a way to keep the identity file on the jump box.
Anyway the result should be that you will be able to simply type:
Without worrying about identity files or nested ssh and scp commands. Much easier and probably worth a little mucking around to get working if you do it semi-regular.
Note that ssh is running a shell on the remote end, so the rules are most likely bash or ksh as sh does not do [[]], but not ssh. I guess 'ssh' as 'secure shell' is a misnomer, since it is not a shell but a remote execution tool.