10-13-2012
Shell script to read from a file and update remote server
Its a tough one and would appreciate any guidance for a script that i am trying to develop....Again I do understand its a complicated script and help would be greatly appreciated.... Thank you
1- Need to check for a file (in a certain location on a server) every 15 minute or so if it is there or not ...if it is there then check for two things in that file a) IP address and the status assoicated with that UP b)Status ie pass or fail or suspend
If no file then go back to sleep for 15 minutes and then check again for file..
If status fail then locked the arrived file and run sql command to get server ids and store the sql output to a file.......
Get the server ids from the file one by one and do the following
login to the server and run a command for eg : To update the ip address for server 1 and do that for all the servers that were captured by the SQL output one by one....
once finish with all servers updates then change the name of the locked file
and send an email for the changes that were made and go back to check if another file arrived and start checking every 15 minutes.......
i am sorry its a bit difficult ask and again would appreciate a lot for any guidance and help......... Thank you
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
I am writing a shell script to pull a file from a remote server (Let say its a windows based remote server). One of my criteria is to pull a file only if it is not empty.
We have done a similar script to push a file from our end to a remote server and before pushing it we check for the... (2 Replies)
Discussion started by: sashankkrk
2 Replies
2. Shell Programming and Scripting
I have been trying to implement the following shell script --
sftp to remote server
get list of files in the directory
sftp get the most recent listed file
exit
This script will be scheduled to be executed everyday using CRON or CONTROL-M and the need is to have absolutely no human... (7 Replies)
Discussion started by: toobrown1
7 Replies
3. Shell Programming and Scripting
How to FTP the latest file, based on date, from a remote server through a shell script?
I have four files to be FTP'ed from remote server.
They are of the following format.
build1_runtime_mmddyyyy.txt
build2_runtime_mmddyyyy.txt
build3_runtime_mmddyyyy.txt
buifile_count_mmddyyyy.txt
... (9 Replies)
Discussion started by: imran_affu
9 Replies
4. Programming
Hi All,
I am using a expect script to run a shell script on remote server, the code is as follows. But the problem is that it executes only first command, and hangs it doesn't run the next commands.
spawn ssh $uid@$host
expect "password:"
send "$password\r"
expect "*\r"
send... (2 Replies)
Discussion started by: yashwanthsn
2 Replies
5. Shell Programming and Scripting
Hi All,
I have below requirements for my project:
1. Building a shell script which connects to a remote server
2. running script on local machine as user 'A'
3. connecting to server using user 'B' with password
4. login with a powerbroker role 'P' (asks for same password as 'B') on that... (1 Reply)
Discussion started by: Nishant Ladiwal
1 Replies
6. Shell Programming and Scripting
Hi Scott,
My previous post was not for any school or college projects. I am currently working with a IT company (Cannot provide more details than this). I am trying to implement the below script in my day-to-day work,
Apologies for the confusion in previous post :). My question remains same... (4 Replies)
Discussion started by: Nishant Ladiwal
4 Replies
7. Shell Programming and Scripting
Hi all,
i need to run a shell script on remote server. I have created file .bat file in windows server with following code,
c:\Users\Desktop\putty.exe -ssh -pw password user@server ./script.sh
i need to run the script.sh in my remote server
Above command is not working, any... (4 Replies)
Discussion started by: rammm
4 Replies
8. Shell Programming and Scripting
Hi guys,
So i am in server1 and i have to login to server 2, 3,4 and run some script there(logging script) and output its result. What i am doing is running the script in server2 and outputting it to a file in server 2 and then Scp'ing the file to server1. Similarly i am doing this for other... (5 Replies)
Discussion started by: srkmish
5 Replies
9. Shell Programming and Scripting
I have a script, which connecting to remote server and first checks, if the files are there by timestamp. If not I want the script exit without error. Below is a code
TARFILE=${NAME}.tar
TARGZFILE=${NAME}.tar.gz
ssh ${DESTSERVNAME} 'cd /export/home/iciprod/download/let/monthly;... (3 Replies)
Discussion started by: digioleg54
3 Replies
10. Shell Programming and Scripting
local script:
cat > first.sh
cd /tmp
echo $PWD
echo `whoami`
cd /tmp/123
tar -cvf 789.tar 456
sleep 10
except script:
cat > first
#!/usr/bin/expect
set ip 10.5.15.20
set user "xyz123"
set password "123456"
set script first.sh
spawn sh -c "ssh $user@$ip bash < $script" (1 Reply)
Discussion started by: Aditya Avanth
1 Replies
LEARN ABOUT ULTRIX
yppush
yppush(8yp) yppush(8yp)
Name
yppush - force propagation of a changed yellow pages (YP) map
Syntax
yppush [ -d domain ] [ -v ] mapname
Description
The command copies a new version of a yellow pages (YP) map from the master YP server to the slave YP servers. It is normally run only on
the master YP server by the utility accessing the after the master YP databases have been changed. When invoked, first constructs a list
of YP server hosts by reading the YP map ypservers within the domain. Keys within the map ypservers are the ASCII names of the machines on
which the YP servers run.
A transfer map request is sent to the YP server at each host, along with the information needed by the transfer agent (the program which
actually moves the map) to call back the command. When the attempt has completed (successfully or not), and the transfer agent has sent a
status message, the results can be printed to stdout. Messages are also printed when a transfer is not possible, for instance when the
request message is undeliverable, or when the timeout period on responses has expired.
Refer to and for an overview of the yellow pages.
Options
-d Specify a domain.
-v Verbose. This causes messages to be printed when each server is called, and for each response. Without this flag, only error mes-
sages are printed.
Restrictions
In the current implementation (version 2 YP protocol), the transfer agent is which is started by the program. If detects that it is speak-
ing to a version 1 YP protocol server, it uses the older protocol, sending a version 1 YPPROC_GET request and issues a message to that
effect. Unfortunately, there is no way of knowing if or when the map transfer was performed for version 1 servers. The command prints a
message saying that an old-style message has been sent. The system administrator should later check to see that the transfer has actually
taken place.
Files
/etc/yp/domainname/ypservers.{dir, pag}
See Also
ypfiles(5yp), ypserv(8yp), ypxfr(8yp)
yppush(8yp)