This is a discussion on script to rm files on multiple servers within the Shell scripting forums, part of the Development/Scripting category; Hello All, New guy to the " dark side " of command line and trying hard to improve/establish a decent ...
|
|||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
|||
|
Hello All,
New guy to the " dark side " of command line and trying hard to improve/establish a decent bash scripting ability. Have a need for a script sooner than later so I thought I would call out for help. I need to have a bash script that can rm a file from multiple servers if logged onto one. Is there an easy way to do this? I am thinking that I need a variable list of server names to use in the script along with just a simple rm /filepath. Wouldn't I have to somehow " log into" each server to do the remove? Would the script have to include an ssh to each server in the variable list ? Trying to think out loud for this.... Thanks in advance for the help, Steve |
| Sponsored Links | ||
|
|
|
||||
|
Steve,
Welcome to nixCraft forum! Yes a script can be used to run files and all other stuff. First, you need to setup password less login using ssh-keys between your host and other servers: Howto Linux / UNIX setup SSH with DSA public key authentication (password less login) Howto use multiple SSH keys for password less login The host will run a script, it will login to each system and it will remove files. Here is a sample script to kick start development: Code:
#!/bin/bash SERVERS="box1 box2 box3" for b in $SERVERS do ssh user@$b /bin/rm /path/to/file done
__________________
Rocky Jr. You may have my body & soul, but you will never touch my pride! If you have knowledge, let others light their candles at it. Certified to work on HP-UX / Sun Solaris / RedHat |
![]() |
| Bookmarks |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to change the format of multiple files in different directories | dustcloud4 | Shell scripting | 0 | 06-05-2007 03:03 AM |
| login into multiple servers thru script... | avcert1998 | Shell scripting | 2 | 03-17-2007 03:29 AM |
| Script to add users to multiple servers. | deepakhg | Shell scripting | 0 | 03-17-2007 03:02 AM |
| shell script that parses multiple log files and checks for a | Anonymous | Shell scripting | 1 | 11-15-2006 09:38 PM |
| multiple server status script | marinm | Linux software | 20 | 08-03-2006 06:48 AM |