- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: how to check a file on remote machine
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2003 02:01 AM
06-04-2003 02:01 AM
in a script file, before making a ftpfro a machine 1 to machine 2, i must insert the control if a file exist (ever in a machine 2). which is the best way to control this?
is it better to make a ftp and import on a machine 1 and check if the size is > 0 or create a telnet connection and check the result of the control?
thanks in advice
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2003 02:07 AM
06-04-2003 02:07 AM
Re: how to check a file on remote machine
Zeev
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2003 02:14 AM
06-04-2003 02:14 AM
Re: how to check a file on remote machine
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2003 02:21 AM
06-04-2003 02:21 AM
Re: how to check a file on remote machine
if remsh fails to setup its connection with remote host, then it will flag a failure.
Even if the remote command fails, remsh will always return success only.
To check the remote command status, you may need to redirect the value to a file and check the file.
check the man page for remsh on return value section.
HTH
Umapathy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2003 02:29 AM
06-04-2003 02:29 AM
Re: how to check a file on remote machine
http://www.netsys.com/sunmgr/1997-12/msg00120.html.However I tried and it didn't
work on hp-ux.Should be some way to save remote "$?" - exit status and read it.
Zeev
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2003 02:33 AM
06-04-2003 02:33 AM
Re: how to check a file on remote machine
usually i don't test the ret code for the existance of file, but i count the number of lines in the output and print them.
So
COUNT=$(remsh host -l root -n "ls file" | grep -v "not found" |wc -l )
if $COUNT = 0 -> file does not exists
HTH,
Massimo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2003 02:43 AM
06-04-2003 02:43 AM
SolutionQ: I've been trying to write a script to run a command on a remote machine and determine if the command was successful. However, it always returns 0 regardless of the command's success. What's wrong?
A: Actually, your script is working OK, but the problem is that it isn't what you want. The return code of 0 comes from remsh where 0 means a connection was successful and non-zero means that no connection was possible. remsh does not monitor any command(s) that are sent.
So the solution is to ask the remote system to return the results of executing the remote command. For example:
remsh mymachine 'll /tmp >/dev/null 2>&1 ; echo $?'
will return 0 (ll /tmp was successful) whereas:
remsh mymachine 'll /temp >/dev/null 2>&1 ;echo $?'
will return 1 since ll /temp fails (no such directory). Note also that you should usually use remsh's -n option to avoid hangs when encountering a command or login that requires stdin.
Bless Google :)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2003 04:02 AM
06-04-2003 04:02 AM
Re: how to check a file on remote machine
if the remote machine who containing the file that i must check is a nt machine? remsh it doesn't work. someone have a solution or ftp is the only way to control?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2003 04:03 AM
06-04-2003 04:03 AM
Re: how to check a file on remote machine
I found the trick here:
http://www.interex.org/pubcontent/enterprise/nov01/qabh1101.jsp
Zeev
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2003 04:07 AM
06-04-2003 04:07 AM
Re: how to check a file on remote machine
Check this link though:
http://www.denicomp.com/rshdnt.htm
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2003 04:38 AM
06-04-2003 04:38 AM