Sponsored Content
Top Forums Shell Programming and Scripting Checking the file in remote server using SFTP Post 302371235 by govindts on Friday 13th of November 2009 05:43:51 PM
Old 11-13-2009
Checking the file in remote server using SFTP

Hello, I would appreciate if any one can help me on this.

The below script start running at 12:30AM. Every 5 min, i go and check the remote site. If i see filewatch.txt over there, then i need to call another shell script and load the data into database. If i don't see that file, then i have to loop for one hour(sleep 5 every iteration) and keep check the filewatch.txt. If i don't find at 1.00AM, then send email to entire team.

Here is the below script.

Code:
while true
do
sftp dmchain@xyz.com
cd /hqspool/scc02505/DATA/B1P/outbound/datafiles/report
if [ -f filewatch.txt ]
then
echo "file found"
else
echo "file  not found"
fi
exit
done

This script is not working... It is hanging.. But i am able to connect manually and sftp the files...

Here is the output of the above script...

Code:
uixpad01(orcl) /odsimp/apps/xyz
==> sh gt.sh
Connecting to xyz.com...

Am i missing anything here... Please advise...
 

10 More Discussions You Might Find Interesting

1. IP Networking

Checking for availability of remote server

Hi. In my KSH script I'm running a command on a remote server. I want to know how I can test to see if the remote server is available (accessible) prior to running the command. Any ideas? My command looks like: `ssh $USER@$TARGET_SERVER_DNS ls -l $REMOTE_FOLDER ` This check should be... (1 Reply)
Discussion started by: dylanmilks
1 Replies

2. Shell Programming and Scripting

Checking for availability of remote server

Hi. In my KSH script I'm running a command on a remote server. I want to know how I can test to see if the remote server is available (accessible) prior to running the command. Any ideas? My command looks like: `ssh $USER@$TARGET_SERVER_DNS ls -l $REMOTE_FOLDER ` This check should be... (4 Replies)
Discussion started by: dylanmilks
4 Replies

3. Solaris

Checking a file on a remote windows server

Hi Everyone! This is what I need to do... I am deploying some directories over to a windows server 2000/3 box from my solaris10 box and I need to make sure the directories exist. The only form of connection I have to work with is SSH Currently, my script deploys the directories over... (13 Replies)
Discussion started by: Keepcase
13 Replies

4. 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

5. Programming

SFTP from one remote server to another remote server from desktop

Hi, I have 1. lappy 2. server A 3. server B Now, what i need is to run a command from lappy that will sftp a file from server A to server B. Please guide me to achieve this. -akash (1 Reply)
Discussion started by: akash.mahakode
1 Replies

6. Shell Programming and Scripting

SFTP - Get size of file on remote server

Hi, I have a requirement where I need to do SFTP connection to remote server, get the size of the file on remote server and depending on the size, i need to get the file onto local server. Is there any command in SFTP to get the size of the file. I found one in FTP but not in SFTP (2 Replies)
Discussion started by: forums123456
2 Replies

7. UNIX for Dummies Questions & Answers

Checking files in remote server and decide to copy file or not

Hi there, I have a problem in my script, I need to check whether file exists in remote server or not, if the file exists, then stop copy else copy the file to the server.. my code is something like this while read $server do if ssh $server "cd $directory_name; if ; then echo "Error:... (2 Replies)
Discussion started by: beezy
2 Replies

8. Shell Programming and Scripting

SFTP problem......File not getting from Remote server

Hi, We are using one unix script which is using sftp command and connect to remote server and get some file form remote server. some time after running this script we are not getting any file . Could you please tell us detailed validation that is there any problem with... (6 Replies)
Discussion started by: maheshkumar93@g
6 Replies

9. Solaris

Script to get files from remote server to local server through sftp without prompting for password

Hi, I am trying to automate the process of fetching files from remote server to local server through sftp. I have the username and password for the remote solaris server. But I need to give password manually everytime i run the script. Can anyone help me in automating the script such that it... (3 Replies)
Discussion started by: ssk250
3 Replies

10. UNIX for Advanced & Expert Users

SFTP from remote server

Hi All,While sftp from remote server an error (/) is coming before the file in a script.Please find the below log. The file is on home directory on remote server. (6 Replies)
Discussion started by: kiranparsha
6 Replies
Foreign(4)						     Kernel Interfaces Manual							Foreign(4)

NAME
Foreign - Logs contact attempts from unknown systems SYNOPSIS
/usr/lib/uucp/.Admin/Foreign DESCRIPTION
The /usr/lib/uucp/.Admin/Foreign file lists access attempts by unknown systems. The /usr/lib/uucp/remote.unknown shell script appends an entry to the Foreign file each time a remote computer that is not listed in the local /usr/lib/uucp/Systems file attempts to communicate with that local system. Someone with superuser authority can customize entries in the Foreign file to fit the needs of a specific site by modifying the remote.unknown shell script. EXAMPLES
The following is a sample entry in the Foreign file: Wed Sep 20 20:38:22 CDT 1989: call from the system merlin System merlin, which is not listed in the /usr/lib/uucp/Systems file, attempted to log in on September 20 at 10:38 p.m., but the uucp pro- gram did not allow the unknown system to log in. FILES
Describes access permissions for remote systems Describes accessible remote systems Records contacts from unknown systems in the Foreign file Contains the Foreign file and other uucp administrative files RELATED INFORMATION
Commands: uucp(1), uudemon.cleanu(4), uux(1) Daemons: cron(8), uucico(8), uuxqt(1) delim off Foreign(4)
All times are GMT -4. The time now is 07:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy