- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Can I set a timeout to cp?
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
Discussions
Discussions
Forums
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
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-02-2005 08:34 PM
тАО06-02-2005 08:34 PM
So is it possible to set a 90 minutes timeout for cp for example?
Thanks,
Eric Antunes
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-02-2005 08:47 PM
тАО06-02-2005 08:47 PM
Re: Can I set a timeout to cp?
In you script after the database shutdown and when you issue the cp command you chekc for the retun code.
Whne the retun code is not zero it. not successfull then define the following and have the sleep wait_time in a loop.
Eg:-
WAIT_TIME=30
TIMEOUT=900
TIMER=0
Check with the return code of the cp command and then have the following in a loop.
while [ $retruncode -eq 1 ]
do
echo "Waiting for the database copy..."
sleep ${WAIT_TIME}
TIMER=`expr $TIMER + ${WAIT_TIME}`
if [ $TIMER -ge $TIMEOUT ] ; then
echo "\nWARNING: Timeout while waiting for copying to complete.\n"
RC=8
fi
done
IA
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-02-2005 08:51 PM
тАО06-02-2005 08:51 PM
Re: Can I set a timeout to cp?
If you want to make timeout to cp process then,
execute cp operation in a process with background mode. Get the PID and sleep for 90 minutues and check PID is completed or not. If not kill that.
Example:
shutdown() {
..
}
copy() {
rcp backupserver:/tmp/test/*.db /database/
}
start(){
...
}
shutdown
copy &
PID=$!
start
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-02-2005 08:54 PM
тАО06-02-2005 08:54 PM
Re: Can I set a timeout to cp?
shutdown
copy &
PID=$!
sleep 90860
kill -9 $PID 2>/dev/null
start
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-02-2005 08:59 PM
тАО06-02-2005 08:59 PM
Re: Can I set a timeout to cp?
that means even if the cp is successful, you still have to wait 90 minutes!
You'd want to sleep for 1 minute and check the PID. Put the sleep/check in a loop that executes 90 times, unless the PID disappears in which case it would break/stop.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-02-2005 09:03 PM
тАО06-02-2005 09:03 PM
Re: Can I set a timeout to cp?
Basic concept is we have to make cp operation in background and control that with it's PID. We can add points like getting return code from cp and ps -ef | grep -v grep | grep -q $PID return code to make sleep 90 minutes operation.
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-02-2005 09:42 PM
тАО06-02-2005 09:42 PM
Re: Can I set a timeout to cp?
I'm analysing the proposed solutions to assign points more correctly after.
Thanks,
Eric Antunes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-03-2005 12:19 AM
тАО06-03-2005 12:19 AM
Re: Can I set a timeout to cp?
WAIT_TIME=30
TIMEOUT=300
TIMER=0
SOURCE_DIR=/disc1/patches
DESTINATION_DIR=/
cp -R $SOURCE_DIR/* $DESTINATION_DIR
while [ $exit_code -eq 1]
do
sleep ${WAIT_TIME}
TIMER=`expr $TIMER + ${WAIT_TIME}`
if [$TIMER ge $TIMEOUT]; then
echo "\WARNING: ...!\n"
exit_code=8
fi
But I get:
"Syntax error at line 49 : `do' is not matched.". I'm missing something with the "while do" cicle...?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-03-2005 12:21 AM
тАО06-03-2005 12:21 AM
Re: Can I set a timeout to cp?
done
if .. fi
do .. done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-03-2005 12:57 AM
тАО06-03-2005 12:57 AM
Re: Can I set a timeout to cp?
you may also wish to add the "-p" switch when doing the cp -R...
-p will cause cp to preserve in the copy as many of the modification time, access time, file mode, user ID, and group ID as allowed by permissions.
hope this helps too!
regards
yogeeraj