- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Help me complete this script
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
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-24-2004 04:15 AM
06-24-2004 04:15 AM
cp STOCK_FILE /var/STOCK_ARCHIVE/STOCK_FILE
sleep 900
until [ diff STOCK_FILE /var/STOCK_ARCHIVE/STOCK_FILE =0 ]
cp STOCK_FILE /var/STOCK_ARCHIVE/STOCK_FILE
sleep 300
I don't know how to do the test statement so that it checks that the diff comparison returns no difference. If there is a difference then the original file should overwrite the copy, wait 5 minutes and then try again to see if the file is done.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2004 04:28 AM
06-24-2004 04:28 AM
Re: Help me complete this script
size_of_desti=` ll \dest\file|awk '{print $5}`
if [ ${size_of_source} -eq ${size_of_desti} ];then
echo "File copy OK"
exit 0
else
sleep sometime
cp source_file dest_file
fi
Anil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2004 04:37 AM
06-24-2004 04:37 AM
Re: Help me complete this script
This should make a reasonable test for you:
diff file1 file2 >/dev/null 2>&1
STAT=${?}
if [[ ${STAT} -eq 0 ]]
then
echo "Files the same"
else
echo "They ain't"
fi
You could also use the output of the cksum command for each file and compare them.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2004 05:01 AM
06-24-2004 05:01 AM
Re: Help me complete this script
cp bla /archiv/bla
if [ $? -ne 0 ]
then
echo Copy failed ...
fi
Kaps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2004 06:11 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2004 06:35 AM
06-24-2004 06:35 AM
Re: Help me complete this script
While the other two answers were usable, I wasn't looking for if statements, I needed it to loop until they matched hence the use of until.
Also Dan's answer was exactly what I needed and only required the one line. Simplicity is always preferable.
Thanks to all who answered.