Quote:
I don't see an immediate reason why your script should run slow. Try using the -x (xtrace option to isolate where / which line it has its difficulties; mayhap the remote login?
Please post all files' contents so people get a chance to follow what you are doing.
Can you explain how to implement that xtrace? Is this an option on SCP? I can't find it in the manpage
And here is my reason that I think it can be better. It logs in each time it needs a file, instead of log in once and then gets ALL the files off and after that, it should log off and log on to the next server. in my noob opinion, this would save time. Correct me if I am wrong. I just don't know how to do that.
For two servers now it takes about 10 seconds, but in production, it will be a lot more and some are fast responding and some are not, so I want to have the script as fast as possible.
there is not much to it.
I have three plain text files
1 with two servers in it, each server on its own line like:
192.168.122.7
192.168.122.74
1 with the path to the files needed like this:
/path/to/file
/path/to/file2
also each on its own line.
the last file is the password file and has only one password in it. I don't need the password in production, because the script server already has root access to all the other servers and doesn't need to log in.
Some remarks:
[QOUTE]- you use arrays, but don't increment / modify the respective indices?[/QUOTE]
do you have a link to an explanation what you mean, so I check that and learn?
Quote:
- you're using FOUR nested loops, to what avail?
one for error handling (show a message and exit the script when the folder that needs to be empty, doesn't exist.)
one to loop through the servers
one to create the folders per server name
one to loop through the file paths
Quote:
- how do you expect to use ssh_pass variable / file on various servers?
As I explained above I don't need that in production but have that in place for my test VM's, they both have the same password, so I don't need to run through that file.
I included my log file to this message
Thanks for the quick response btw!
With kind regards,
Cornelis