- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- remsh remote directory exist test
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
04-22-2005 09:47 AM
04-22-2005 09:47 AM
My problem is test a directory exist or not
In a remote (name ctcyborg) server , I could test directory locally.
# test -d /home/blu/rvele (a not exist directory)
# echo $?
1
# test -d /home/blu/rvelez
# echo $?
0
# test ! -d /home/blu/rvelez
# echo $?
1
But in peer remote server to ctcyborg, I could not get expected result.
# remsh ctcyborg test -d /home/blu/rvelez
# echo $?
0
# remsh ctcyborg test ! -d /home/blu/rvelez
# echo $?
0
As we promote files from dev machine to production machine. A script could make us operation less-error in typo.
We have to verify the directory exist in remote machine first, then rcp files over.
I could test a remote server directory exist or not. As my following script always abort, even the remote directory exit.
if remsh ctcyborg test ! -d /home/blu/rvelez
then
echo " there is no /home/blu/rvelez directory in ctcyborg, ABORT"
exit 1
fi
Thank you
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2005 09:55 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2005 11:32 AM
04-22-2005 11:32 AM
Re: remsh remote directory exist test
It is great, As I spent alot other combinations. they all do not work today. I got what I expected from you.
# remsh ctcyborg 'test ! -d /home/blu/rvelez; echo $?'
1
# remsh ctcyborg 'test -d /home/blu/rvelez; echo $?'
0
Thanks a lot
Bin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2005 12:16 PM
04-22-2005 12:16 PM
Re: remsh remote directory exist test
I am a newbie in scripting.
But, after I put it in script, it always abort, when 1 come up, it should not execute "then ...fi" block, but
for m in `cat $FILENAME"1"`
do
if remsh ctcyborg 'test ! -d /home/blu/rvelez; echo $?'
then
echo " there is no /home/blu/rvelez directory in ctcyborg, ABORT"
exit 1
fi
rcp -p /home/blu/$m ctcyborg:/home/blu/rvelez/$m
output below with first line -x option
+ remsh ctcyborg test ! -d /home/blu/rvelez; echo $?
1
+ echo there is no /home/blu/rvelez directory in ctcyborg, ABORT
there is no /home/blu/rvelez directory in ctcyborg, ABORT
+ exit 1
This happened when there is a /home/blu/rvelez directory in ctcyborg server.
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2005 12:27 PM
04-22-2005 12:27 PM
Re: remsh remote directory exist test
success even if the directory does not exists. You
need to catch the 'echo $?' part in the remsh
command see if it's zero. Change the script to
following:
-------
for m in `cat $FILENAME"1"`
do
tmp=$(remsh ctcyborg 'test ! -d /home/blu/rvelez; echo $?')
if [ $tmp -eq 0 ]
then
echo " there is no /home/blu/rvelez directory in ctcyborg, ABORT"
exit 1
fi
- Biswajit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2005 01:18 PM
04-22-2005 01:18 PM
Re: remsh remote directory exist test
Your point makes the script behaviour on the track. Then it brought my question to the end.
Thank you very much,
Bin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2005 12:00 AM
04-25-2005 12:00 AM
Re: remsh remote directory exist test
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2005 01:02 AM
05-03-2005 01:02 AM
Re: remsh remote directory exist test
Now, I know how I should do here.