Sponsored Content
Top Forums Shell Programming and Scripting Loop through the accounts and servers Post 302275963 by pareshan on Monday 12th of January 2009 05:09:57 PM
Old 01-12-2009
Loop through the accounts and servers

Hi everyone, I am trying to use loop (for loop but can be any loop) which will read from the file (text file) which will have 2 column one for account and another for server which kind of look like this

account1 server1
account2 server2
account3 server1
account4 server1
5 server3
6 server2
7 server2
8 server3
9 server4
10 server4

now here I have to run couple of ksh scripts which i wrote (example tar, stop, start). I have to read from the text file and using those accounts and respective servers I have to login and run those scripts one at a time for all the accounts and respective servers.

If there are 10 accounts they may be in 3 or 4 differnt servers and may not be in sequence as i have writeen down above but thats not a big issue I can put that in some sequence if needed. Write now I am doing it using multiple text files. If I have accounts in 5 servers then I put five text files where I put accounts name and loop through them using resepctive server but I need some way to do that using one text file as I have written before.

I hope I made it clear this time if not i will try to elaborate more later on

I will really appreciate any help
thanks alot
 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Mail accounts

Hi there I am a newbie. want to learn followings: 1. How can i create an mail only account.? 2. Where is the file containing mail accounts?What is the path? 3. Can i create mail accounts from PHP? Thanx (3 Replies)
Discussion started by: vbs
3 Replies

2. Shell Programming and Scripting

User Accounts

I have found a script to create user accounts. But there are a few lines i dont understand. Can someone help me with this? Here's the code: ###################################### while ; do ACCT=${USER_ACCT}${START} START=`expr $START + 1` START=`echo ${START} | awk... (3 Replies)
Discussion started by: Sensor
3 Replies

3. Post Here to Contact Site Administrators and Moderators

Combine Accounts

I have two different accounts under two names. That is my fault and I own that issue. I would like to combine the two account or just remove one of them. How do I go about doing that on this site. (1 Reply)
Discussion started by: crobinson
1 Replies

4. Shell Programming and Scripting

Problem sshing to multiple servers while in a loop

I have the following block from a script (it's not the entire script, but I'm confident it's all that is pertinent) echo "$SESSIONS"|while read ID;do ASSETID=$(echo "$ERRORS"|grep -i "$ID"|grep FX_Media_Session_Playlist::init_playlist|grep -i asset_id=|awk '{print $11}') BLADE=$(echo... (2 Replies)
Discussion started by: DeCoTwc
2 Replies

5. Red Hat

For loop to add user accounts

Hi i need to add 100 users on a redhat linux box . Can you guys help me . useradd -u 123456 -g 400000 -G 4545 -c " abcdef " -m -d /home/abcd -s /bin/bash abcd (1 Reply)
Discussion started by: karthik9358
1 Replies

6. Shell Programming and Scripting

Ssh to an array of servers in a for loop

There are 4 remote hosts that I have stored in an array. A ssh trust has been created from the local host to each of the remote hosts. I am trying to ssh to each of the servers in a for loop as shown below. declare -a host host}]="server1" host}]="server2" host}]="server3" ... (9 Replies)
Discussion started by: Sree10
9 Replies

7. Shell Programming and Scripting

Script To Delete User Accounts On Multiple Servers

Hello All, The servers in question are AIX/Unix servers. I was hoping to find a scripting solution where I could use one server as a jump server and run a script that would check each server for a user account (the source file for the user accounts would be a text file or csv file) , and delete... (4 Replies)
Discussion started by: k45bryant
4 Replies

8. AIX

How to use AD accounts in AIX?

Hello, I've searched on-line (IBM and other sites). But did not get a clear answer/steps. My Requirement: use existing active directory accounts to login to AIX servers Can you please give me some information on how to achieve this. How this Active Directory and AIX server integration... (8 Replies)
Discussion started by: aaron8667
8 Replies
mtailrc(5)							   User Manuals 							mtailrc(5)

NAME
mtailrc - Configuration file for monkeytail DESCRIPTION
A monkeytail configuration uses Apache-style syntax to declare "groups" of files to be tailed. Best explained with an example: <group testgroup> prefix 'server2: ' sudo yes <file> filename /var/log/apache2/access.log prefix 'server1: ' host server1.example.com </file> <file> filename /var/log/apache2/access.log host server2.example.com sudo no </file> </group> OPTIONS
All options can be either put inside a group or file block. Options inside a file block override those in the group block. filename filename filename defines the filename for this block. host remote-host (optional) host defines that this block's file is to be tailed on a remote server. sudo yes|no|1|0 sudo is a boolean specifying whether this file should be tailed as root. This option is supported for both local and remote files (in both cases you will potentially be prompted for your password). prefix "string: " prefix allows you to specify a short string that will be prepended to every line that is displayed for that given file. FILES
~/.mtailrc - user specific monkeytail config SEE ALSO
mtail(1), tail(1) AUTHOR
Martyn Smith <martyn@dollyfish.net.nz> mtail May 2008 mtailrc(5)
All times are GMT -4. The time now is 01:14 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy