Operating System - HP-UX
1748244 Members
3869 Online
108760 Solutions
New Discussion юеВ

Use the file in remote server

 
ivywong1
Occasional Contributor

Use the file in remote server

I have a file ( /tmp/my_file.txt) in local server , I have a script as below , it works fine.

for file in /tmp/my_file.txt ; do

...
...

done


Now , if the file ( /tmp/my_file.txt ) is in remote server , can advise what can i do ? thx
7 REPLIES 7
Dennis Handly
Acclaimed Contributor

Re: Use the file in remote server

It depends on what you are doing in your for-loop. You could use scp/rcp to copy the file to the local system. Or use remsh/ssh to operate on it remotely.

If the file is available over NFS, you can just use the name.
ivy1234
Frequent Advisor

Re: Use the file in remote server

thx reply ,

I perfer the second method you suggested.

can you please advise how to do it ? thx
Dennis Handly
Acclaimed Contributor

Re: Use the file in remote server

>can you please advise how to do it?

What HP-UX version do you have:
You have to enable NFS server, then export those filesystems.
On the client you have to enable NFS client and you need mount those NFS filesystems or set up automounter to only mount them when required.
ivy1234
Frequent Advisor

Re: Use the file in remote server

thx reply ,

I have considered to use mount , but it seems not good in my case as I do not read the file frequenly , so I not perfer use muont , can advise is there other method ? thx
Dennis Handly
Acclaimed Contributor

Re: Use the file in remote server

>so I not prefer use mount, can advise is there other method?

After you set up NFS, you can use the automounter to mount filesystems as needed.

>I do not read the file frequently

You may just run your script on the remote machine.

ivy1234
Frequent Advisor

Re: Use the file in remote server

Thx dennis reply ,

I checked automount is work , but the server is in remote office and connect via VPN , the speed is slow , and I found that sometimes it can not be umount , so that the server have many mounted volumn , so I prefer to use script to do that .

Thanks.
Viktor Balogh
Honored Contributor

Re: Use the file in remote server

Hi,

easier would be if you would add a part to the beginning of your script which copies that file temporary to the local system. Just as in Dennis' first post.
****
Unix operates with beer.