- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Scripting question on HP-UX 11
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
07-29-2002 02:31 AM
07-29-2002 02:31 AM
1. find *.arc | cpio -pdmx /nfs_mounted_dir
2. mv *.arc finalised
Is it possible that statement 1 is not yet finished before statement 2 is processed?
Besides a "sleep", is there some other way to ensure 1 is finished before 2 is executed? How do I test for the cpio's return code for example?
Thanks
Carlo
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2002 02:36 AM
07-29-2002 02:36 AM
Re: Scripting question on HP-UX 11
No, its not possible 2. will run until the command in 1. is done. Its strictly sequential.
You can test the return status with;
[ $? -ne 0 ] && echo previous command failed
You could ensure 1. is finished with a return code of 0 before running 2. by changing your script to;
find *.arc | cpio -pdmx /nfs_mounted_dir
if [ $? -eq 0 ]
then
mv *.arc finalised
else
echo find command failed, didnt run mv
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2002 02:37 AM
07-29-2002 02:37 AM
Re: Scripting question on HP-UX 11
If you have an script with this two steps there is no posible that the second step start until the first finished.
You can check if a command run ok with the shell variable $? if this variable is cero it's fine. Example:
if [ $? = 0 ]
then
mv *.arc finalised
else
echo "error in the CPIO step"
fi
Hope this helps,
Justo.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2002 02:38 AM
07-29-2002 02:38 AM
Re: Scripting question on HP-UX 11
No, the first statement should complete before moving on to the next statement.
To test for the return code of a previous statement, use $? i.e.
if [ $? = 0 ]; then
echo Previous statement worked fine.
fi
Cheers!
James
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2002 02:40 AM
07-29-2002 02:40 AM
SolutionIs "finalised" a directory?
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2002 02:42 AM
07-29-2002 02:42 AM
Re: Scripting question on HP-UX 11
I will try the return codes and come back with points. Thanks guys.
Cheers
Carlo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2002 02:44 AM
07-29-2002 02:44 AM
Re: Scripting question on HP-UX 11
You assure that job 2 waits for the forked background job by the "wait" call (see man wait).
In a more capable language such as C or Perl you would do a fork(), exec(), wait() or waitpid().
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2002 03:01 AM
07-29-2002 03:01 AM
Re: Scripting question on HP-UX 11
Try a quick test with a simple change to your script by replacing the NFS directory with a LOCAL directory.
Also, is the output (STDOUT & STDERR) redirected in any way?
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2002 03:25 AM
07-29-2002 03:25 AM
Re: Scripting question on HP-UX 11
Carlo,
The forum has a new feature that allows you to view any past QUESTIONS you have posted, which allows you to find replies that you haven't acknowledged.
This member has assigned points to 78 of 128 responses to his/her questions.
http://forums.itrc.hp.com/cm/TopSolutions/1,,BR170913!1!questions,00.html
live free or die
harry