Checking a file on a remote windows server


 
Thread Tools Search this Thread
Operating Systems Solaris Checking a file on a remote windows server
# 8  
Old 03-18-2009
Thanks for all the help Tony

when I do the ssh user@box command >> resultfile from unix to unix I get the file

but when I do that same command from unix to windows the file is not created on the windows machine or my local (solaris box)
# 9  
Old 03-18-2009
the command that doesn't give me an output file (just to be more clear)

ssh user@windowsbox test -e filenamelocation >> resultsfile

that resultsfile doesn't show up on my unix box where I'm performing the command or the windows box

is there a way to specify where the output can go? (like explicitly setting the unix host for the results file?)
# 10  
Old 03-18-2009
It should be on the Unix box, could try /tmp/resultfile so you know for definite where it is, note >> will append more lines to resultfile hence better to use > in this situation so you only have the result of the last test run in resultfile.
# 11  
Old 03-18-2009
hrmmm

I don't see any results file... when I do this very command from unix to unix everything works but somewhere between the unix to windows box my output is going missing..

and I forgot to add the last bit to the command (might be able to give someone some insight)


ssh user@windowsbox test -e filenamelocation || echo $? > /tmp/results
# 12  
Old 03-18-2009
Thanks Tony

I'm going to play around with this and see if I can get that output

if anyone knows what I'm doing wrong with that command, I would really appreciate the advice

Thanks
Erin
# 13  
Old 03-18-2009
UPDATE:

the following command works for unix to unix (tested on Solaris10)

(this is a simple way to verify files)

ssh user@hostname test -e file_to_check ; echo $? /tmp/exitstatus

that will give you a 1 or 0 in relation to the file being there or not


Anyways, that does not work with my unix > windows ordeal... I always get 0 exit status

I've tried Tony's other solution regarding ls and using grep for the exit status and that is working for me

If there are any other possible ways I would love to hear it Smilie
# 14  
Old 03-19-2009
Kepepcase:
The speech marks around the command "test -e file_to_check ; echo $?" as in:

# ssh user@hostname "test -e file_to_check ; echo $?" > /tmp/exitstatus

ensures that the commands in the speech marks are run on the remote machine, the:
> /tmp/exitstatus
will therefore do its stuff on your local machine and should create the file on the local machine.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Checking integrity copied from remote server using UNIX command

I am getting a file (abc.txt) using scp from remote server. scp <connect string> -i $HOME/.ssh/id_dsa rem_id@hostname:/var/prod/abc.txt /var/prod/abc.out Before loading I need to check if the file is indeed same , for that I thought of checking the line count but when I used ssh command it was... (3 Replies)
Discussion started by: lalitpct
3 Replies

2. Shell Programming and Scripting

Do I require remote login access to a windows server to transfer files from a UNIX server

Hi All I need to transfer a file from a UNIX server to a windows server. I saw that it is possible to do this using scp command by looking at the forum listed below: ... (2 Replies)
Discussion started by: vx04
2 Replies

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

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

5. Shell Programming and Scripting

FTP using script not working (for transfering file from a remote unix server to windows PC.)

hi, Im using the following code for FTP #!/usr/bin/ksh ftp -v -n "10.29.45.11" << cmd user "mahesva" "mahesva123" get rtl.tar quit cmd Below is the log when i run the above code ********************************** Connected to 10.29.45.11. 220 (vsFTPd 2.0.1) 530 Please login with USER... (20 Replies)
Discussion started by: dll_fpga
20 Replies

6. Shell Programming and Scripting

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... (2 Replies)
Discussion started by: govindts
2 Replies

7. Linux

Install Linux on remote server from Windows PC

I am very new with servers and have never used Linux. The server I'm looking at is not currently connected to anything, and I wish to install Linux on this server. It doesn't have a monitor (no video card) or keyboard. It does have a DVD. Can I communicate with that server using a Windows PC to... (8 Replies)
Discussion started by: kvalenti
8 Replies

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

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