I would like to have a (bash) script to rename a file on multiple remote linux servers
any idea how to do it?
thanks.
Linux – how to rename a remote file on linux with script
bashcentoslinuxrenamescripting
bashcentoslinuxrenamescripting
I would like to have a (bash) script to rename a file on multiple remote linux servers
any idea how to do it?
thanks.
Best Answer
You can use ssh for that. For example:
You may want to have a list of servers stored in a environment variable:
and a function (for example) in your bashrc (or a dedicated script):
so you can call it whenever you want to do tasks for each of your servers. For example rename files as you wanted:
or (just to show you how to scape the command to pass through ssh):
Obviously this can be as robust as you wish (enabling arrays of servername/sshport), syntax checks, etc...