Shell script to read from a file and update remote server


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Shell script to read from a file and update remote server
# 1  
Old 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
# 2  
Old 10-13-2012
What have you done so far to solve the problem?

We gladly will help you achieving what you need, but we won't do it for you. So show us what you have so far, however little, and we will help you make it better.

For a starter: if you need to repeat the process every 15 minutes you do NOT need any provision for that in your script. You can simply put your script once it is written in "cron" and have it called every 15 minutes.

Ok, i have solved one of your points already, now show what you have got.

I hope this helps.

bakunin
# 3  
Old 10-13-2012
I have been advised not to use cron ... i am also trying to put a script together and will share it with you shortly... Thank you for your reply....
# 4  
Old 10-15-2012
anyone up for this challenge... i give up...Thanks in advance
# 5  
Old 10-16-2012
There is no "challenge". You were asked to show your efforts and have come up blank. If you can't be brought to do your work, why should we?

As you "give up" (your words), so do we.

Moderator's Comments:
Mod Comment Thread closed.


bakunin
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Except script to run a local shell script on remote server using root access

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

2. Shell Programming and Scripting

Script connect to remote server, not find files and exit only from remote server, but not from scrip

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

3. Shell Programming and Scripting

How to Append the output of a script running in remote server to a file in local server?

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

4. Shell Programming and Scripting

To run a shell script in remote server from windows batch file

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

5. Shell Programming and Scripting

Editing a file on remote server using shell script locally

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

6. Shell Programming and Scripting

Editing a file on remote server using shell script locally

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

7. Programming

Expect script to run a Shell script on remote server

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

8. Shell Programming and Scripting

How to FTP the latest file, based on date, from a remote server through a shell script?

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

9. Shell Programming and Scripting

Use cURL in shell script and get most recent file from remote server using SFTP

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

10. UNIX for Dummies Questions & Answers

Pull a file from a remote server through a shell script

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
Login or Register to Ask a Question