Linux / UNIX Tech Support Forum
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 ...
|
|||||||
| Shell scripting You can discuss the shell scripting, request shell scripts and scripting techniques |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
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. What's wrong? I hope I am not making you uncomfortable... Never send a boy to do a mans job. |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| multiple server status script | marinm | Linux software | 27 | 06-05-2009 09:44 PM |
| how to change the format of multiple files in different directories | dustcloud4 | Shell scripting | 0 | 05-06-2007 03:03 AM |
| login into multiple servers thru script... | avcert1998 | Shell scripting | 2 | 17-03-2007 03:29 AM |
| Script to add users to multiple servers. | deepakhg | Shell scripting | 0 | 17-03-2007 03:02 AM |
| shell script that parses multiple log files and checks for a | Anonymous | Shell scripting | 1 | 15-11-2006 09:38 PM |