How can I update a file on 50 systems at once?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How can I update a file on 50 systems at once?
# 1  
Old 12-19-2001
Question How can I update a file on 50 systems at once?

I need to update a file that is on 50 different systems at once. In case of planned network outages I would like to overwrite or lock a monitoring script so that it doesn't send notifications.

I thought of using a script that ftp 's the updated file to all 50 systems, and then overwrites the existing file. When I want to turn it back on I would just do the same. Is there a better way to do this? I don't have root access on any of these systems and in some case r commands are disabled. Suggestions?
# 2  
Old 12-19-2001
Most likely you a host that handles mail for you site and all 50 systems forward mail to this host for delivery. On that host, which I will call "mailhost", you should install an alias just for this script (you will need help from the admin of mailhost). All 50 scripts should send mail to this one alias. As people leave or join the company you can update the alias easily. And during an outage you can set it to nobody.
# 3  
Old 12-19-2001
Java Multiple mail servers?

We have multiple mail servers that route mail for internal and external addresses.

Since the file that I need to change is also being used by other applications I would like to just make changes to that file instead of filtering email. By changing the file it allows me to make changes on the fly based on the need.

How would I use ftp to autologin to these 50 systems and overwrite?

I found a snippit of a script that with a little modification may work.
Code:
if [ ! -f /tmp/$TSTFILE ]
then
    ftp -n kdcsrv1 <<EOT
    user ftp MON@$SYSTEM
    cd MON
    lcd /tmp
    ascii
    put ${TMPFILE}
    get ${TMPFILE} ${TSTFILE}
    close
    quit
EOT
fi

added code tags for readability --oombera

Last edited by oombera; 02-20-2004 at 02:34 AM..
# 4  
Old 12-19-2001
If you have the same account and password on all 50, then it's pretty easy...
Code:
#! /usr/bin/ksh

LIST="host1 system2 this that whatever"

USER=darthur

print -n "Enter password -"
stty -echo
read PASSWORD
stty echo
print

exec 4>&1
ftp -nv >&4 2>&4 |&

for SYSTEM in $LIST ; do
       print -p open $SYSTEM
       print -p user $USER $PASSWORD
       print -p cd directory
       print -p ls -l
       print -p close
done

print -p bye
wait
exit 0

# 5  
Old 12-21-2001
You could have each system look for an external flag that is set or clear. If the flag is clear, then everything is normal. If the flag is set, then don't send the notifications and do something different (per your requirements).


So, how do you easily get 50 hosts to look at a single external flag? There are many creative ways. You could have a command line web utility that tries to access a web page (your flag). If the page exists, then FLAG SET. If no page exists, FLAG CLEAR.

There are literally hundreds of variations on this theme using just about any client-server protocol imaginable.

If I had to effect 50 servers, I would use a single external flag and have each 50 check for the flag status in a crontab script. The creativity of the crontab script checking for a external flag is almost unlimited. (many-to-one).

There are so many ways to effect this..... the method is really a matter of personal choice. You could use a publish/subscribe mechanism to send flags in a one-to-many model as well.
# 6  
Old 12-21-2001
script Not auto entering password

Perderabo,

Thanks for the sample script. I am having one problem though. When I execute the script It prints my password to the screen. I hit enter then it open ftp connection to the first system in the list and prompts me for the password. I was expecting it to enter the password. I don't quite understand the >&4 2>&4 portion of the script.
# 7  
Old 12-21-2001
See this post for an explanation of the funky re-direction.

As for the password, I just retested the script and it works fine for me and never displays my password. You need to enter your password once at the beginning. But echo is turned off so it won't display. The "read PASSWORD" saves your password and the "print -p $USER $PASSWORD" should feed it into the ftp program. Make sure that you have those lines correct. If so, try:
print -p $USER "$PASSWORD"
which might be needed if your password contains funky characters. If this is still failing, try running "ftp -nv" by hand and entering the commands
open hostname
user darthur xyzzy
except change hostname, darthur, and xyzzy to whatever makes sense at your site. This will tell you if your server can accept command in that form. (It would be very bad if it doesn't.)
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Get latest update for RHEL systems

Hi all, I want to get latest package updates for my RHEL systems. I don't any account with RHN so that I can get updates from there. All I'm interested in knowing is that is it possible to get package updates without registering with RHN. And If yes then how. I have read about RHN satellite and... (3 Replies)
Discussion started by: Darshan Parab
3 Replies

2. SCO

Distinguish between file systems

Hello, is there any command in SCO unix by which I can check if the file system is HTFS or DTFS? Thanks (1 Reply)
Discussion started by: Mick
1 Replies

3. Shell Programming and Scripting

Copy file systems

I have to copy 3 file systems from one machine to another on the same local network. Total data is about 150gb. There is not enough free space on the source system to tar the files and then copy. I have to do this remotely, no tape or dvd I need to maintain permissions and ownership. I have... (2 Replies)
Discussion started by: jgt
2 Replies

4. What is on Your Mind?

From Systems Admin to Systems Eng.

I have been wondering how do Systems Administrators do the jump into Systems Engineering? Is it only a matter of time and experience or could I actually help myself get there? Opinions? Books I could read? Thanks a lot for your help! (0 Replies)
Discussion started by: svalenciatech
0 Replies

5. SCO

file systems table

hi Where is file systems table stored, I mean which config file from SCO 5.0.6? On linux is in /etc/fstab. (1 Reply)
Discussion started by: ccc
1 Replies

6. Red Hat

file systems may become read-only

Some of my file systems become read only. I want to find out when that happend. I checked /var/log/messages on that server and I dont see anything there. Is there any other ways to check that. I really need to find out when and how that happend. Thanks (4 Replies)
Discussion started by: s_linux
4 Replies

7. UNIX for Dummies Questions & Answers

file systems for unix

please someone give me 3 file systems for unix HP-UX version !!! thnks (2 Replies)
Discussion started by: androc
2 Replies

8. UNIX for Dummies Questions & Answers

File systems...

Hello guys, I am new in Unix world. I would like know, how Can I check which type of file system (GPFS, JFS) is on the AIX server. I have AIX 5.1. Could you anyone advice me? Thanks. (4 Replies)
Discussion started by: sokratis
4 Replies

9. UNIX for Dummies Questions & Answers

Resizing File-Systems

can someone tell me the basic steps needed to resize and existing filesystem that already has data on it? thanks I dont need to be pointed to a website so any real time real life advice or help will be wholly appreciated (4 Replies)
Discussion started by: TRUEST
4 Replies

10. UNIX for Dummies Questions & Answers

Checking file systems

I am trying to resurrect an old UNIX server without any joy, I do not have much UNIX experience any I don't understand the messages I am receiving. The system is telling me that it cannot go multi - user until the following file systems are checked //dev/rroot It gives me the procedure 1)... (1 Reply)
Discussion started by: ianie
1 Replies
Login or Register to Ask a Question