- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Remote Command To Check File
Operating System - HP-UX
1752797
Members
5992
Online
108789
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
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
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- 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
тАО03-05-2010 09:07 AM
тАО03-05-2010 09:07 AM
Hi,
I am trying to work out some script to check for the existence of a file on a remote box. This will be run as a pre-exec job by some maestro jobs. And depending on the results, depends if the job then submits the main job or not.
I need to get 3 results though;
1) Cannot i firstly remsh to the server?
2) If i can, is the file there? Yes or No?
I have attached a copy of what i thought might work but i seem to hit some problems. I have sent all output to a text file so i can see what i am getting back.
When the file exists i get the response to say it has found it. However, if i change the name of the file its looking for, i still get the same response saying it has found it.
So if anyone has any good tips/tricks on how i can get this script to work that would be great.
Thanks
I am trying to work out some script to check for the existence of a file on a remote box. This will be run as a pre-exec job by some maestro jobs. And depending on the results, depends if the job then submits the main job or not.
I need to get 3 results though;
1) Cannot i firstly remsh to the server?
2) If i can, is the file there? Yes or No?
I have attached a copy of what i thought might work but i seem to hit some problems. I have sent all output to a text file so i can see what i am getting back.
When the file exists i get the response to say it has found it. However, if i change the name of the file its looking for, i still get the same response saying it has found it.
So if anyone has any good tips/tricks on how i can get this script to work that would be great.
Thanks
Where is my beer...??
Solved! Go to Solution.
- Tags:
- remsh
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-05-2010 09:26 AM
тАО03-05-2010 09:26 AM
Solution
Hi Andrew:
You could do something as simple as:
# cat ./queryit
#!/usr/bin/sh
typeset HOST=$1
typeset FILE=$2
remsh ${HOST} -n "[ -f ${FILE} ] && echo ${FILE} found || echo ${FILE} missing" 2>/dev/null
[ $? = 0 ] || echo "${HOST} wasn't available"
exit
...run as :
# ./queryit mybox myfile
Notice that I used 'remsh' per your request. A more secure way would be to substitute 'ssh' for 'remsh' and thus use a secure shell connection.
Regards!
...JRF...
You could do something as simple as:
# cat ./queryit
#!/usr/bin/sh
typeset HOST=$1
typeset FILE=$2
remsh ${HOST} -n "[ -f ${FILE} ] && echo ${FILE} found || echo ${FILE} missing" 2>/dev/null
[ $? = 0 ] || echo "${HOST} wasn't available"
exit
...run as :
# ./queryit mybox myfile
Notice that I used 'remsh' per your request. A more secure way would be to substitute 'ssh' for 'remsh' and thus use a secure shell connection.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-08-2010 03:12 AM
тАО03-08-2010 03:12 AM
Re: Remote Command To Check File
JRF,
Brilliant, thanks for that. Exactly what we need.....
Andy
Brilliant, thanks for that. Exactly what we need.....
Andy
Where is my beer...??
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP