The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
file systems for unix androc UNIX for Dummies Questions & Answers 2 08-23-2005 12:31 AM
File systems... sokratis UNIX for Dummies Questions & Answers 4 01-28-2005 10:05 AM
Resizing File-Systems TRUEST UNIX for Dummies Questions & Answers 4 07-08-2003 03:16 PM
remote file copy across 2 systems (AIX and SCO) aji UNIX for Advanced & Expert Users 4 09-13-2002 09:58 AM
Checking file systems ianie UNIX for Dummies Questions & Answers 1 07-26-2001 02:20 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-19-2001
darthur darthur is offline
Registered User
  
 

Join Date: Dec 2001
Location: Overland Patrk
Posts: 62
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 (permalink)  
Old 12-19-2001
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,127
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 (permalink)  
Old 12-19-2001
darthur darthur is offline
Registered User
  
 

Join Date: Dec 2001
Location: Overland Patrk
Posts: 62
Post 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 (permalink)  
Old 12-19-2001
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,127
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 (permalink)  
Old 12-21-2001
Neo's Avatar
Neo Neo is online now Forum Staff  
Administrator
  
 

Join Date: Sep 2000
Location: Asia Pacific
Posts: 6,778
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 (permalink)  
Old 12-21-2001
darthur darthur is offline
Registered User
  
 

Join Date: Dec 2001
Location: Overland Patrk
Posts: 62
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 (permalink)  
Old 12-21-2001
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,127
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.)
Closed Thread

Bookmarks

Tags
mtime

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:41 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0