![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
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? |
|
||||
|
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.. |
|
|||||
|
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
|
|
|||||
|
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. |
|
||||
|
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. |
|
|||||
|
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.) |
![]() |
| Bookmarks |
| Tags |
| mtime |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|