- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- package controll scripts
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-11-2002 04:43 AM
07-11-2002 04:43 AM
Basically it only checks if the previous command's/processe's exit code is ne 0, and if so falls into a case construct to match against certain codes.
It looks as if for the customer_defined* funcs the codes 51, 52 are reserved.
I would like to further fine grade this (viz. inventing some new rc value, which only throws a warning, but doesn't do an application kill, and unmount and unactivation of the packages VG.
So what codes can I use (in order to cling to some SG standard)?
Would any value (in the range of shell arithmetic) above 52 be ok?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2002 05:50 AM
07-11-2002 05:50 AM
Re: package controll scripts
I do this a lot to modify the "/etc/issue" file. I chrc a value into the file that shows which package is running on which node and at what time it started. (Isn't scripting wonderful?)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2002 07:05 AM
07-11-2002 07:05 AM
SolutionWe have a Data Base package that must be running before this Application can be started.
We have a customer defined function that checks the Data Base status. If it fails, then test_return will take the appropriate action. Here is the code from the
Hope this helps.
----1st------
# START OF CUSTOMER DEFINED FUNCTIONS
# This function is a place holder for customer defined functions.
# You should define all actions you want to happen here, before the service is
# started. You can create as many functions as you need.
function Check_DB_package
{
# This function checks to see if the DB package is running
# If it is not it will sleep and try again. This is repeated 'DB_RETRY'
# times.
DATE=`date '+%b %d %X'`
print "${DATE} - Waiting for DB package $DB_PKG to come up!"
while [ $DB_RETRY -ge 0 ];do
CHK_DB=`cmviewcl -p $DB_PKG | tail -1 | awk '{print $2}'`
if [[ "$CHK_DB" = "up" || "$CHK_DB" = "starting" ]];then
DATE=`date '+%b %d %X'`
print "${DATE} - Database is up. Starting application"
return 0
else
DATE=`date '+%b %d %X'`
print "${DATE} - Waiting for DB Package to come up ($DB_RETRY)"
sleep 10
((DB_RETRY=DB_RETRY - 1))
fi
done
# If we get this far then we know that the retry loop expired before the
# database came up. Therefore we will return a failure.
return 1
}
-----2nd--------
Check_DB_package
test_return 51
-----3rd--------
# Test return value of functions and exit with NO RESTART if bad.
# Return values of 0 - 50 are reserved for use by Hewlett-Packard.
# System administrators can use numbers above 50 for return values.
function test_return
{
if (( $? != 0 ))
then
case $1 in
... std stuf ...
51)
print "\tERROR: Function customer_defined_run_cmds"
print "\tERROR: Failed waiting for DB Package to come up"
remove_ip_address
un_export_fs
halt_nfs_services
nfs_defined_halt_cmds
umount_fs
deactivate_volume_group
QUIT 1
;;
-------end---------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2002 10:02 PM
07-11-2002 10:02 PM
Re: package controll scripts
How on earth could I overlook the comment lines *right at the start* of the function definition of test_return? %-{
# Test return value of functions and exit with NO RESTART if bad.
# Return value of 0 - 50 are reserved for use by Hewlett-Packard.
# System administrators can use numbers above 50 for return values.
function test_return
That was all the info I needed.
Now I will insert my own custom 'case' matches with codes above 52 to handle my own exceptions.
I award you the 10 pts. not so much for supplying me with your sample script but for including this vital comment line in your sample that I had overlooked ;-)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-12-2002 05:17 AM
07-12-2002 05:17 AM
Re: package controll scripts
I didn't make my point about modifying the "case" statement properly. If you modify the statement, which was generated by the cmmakepkg -s command, you risk someone coming behind you and overlaying your modifications by running the command again. If the only thing you have to put back into place is a call to your external code, it's much easier to maintain / fix.
I realize this may seem trivial, but I believe in Defensive Programming. You can solve your issue either way....