<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: customer_defined_run_cmds{} in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/customer-defined-run-cmds/m-p/2755134#M710388</link>
    <description>The most common use is for commands which monitor the health of a given package.</description>
    <pubDate>Mon, 01 Jul 2002 00:10:54 GMT</pubDate>
    <dc:creator>A. Clay Stephenson</dc:creator>
    <dc:date>2002-07-01T00:10:54Z</dc:date>
    <item>
      <title>customer_defined_run_cmds{}</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/customer-defined-run-cmds/m-p/2755132#M710386</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Can anybody please let me know a few examples as for what exactly the function needs to include to run when the package is started up?&lt;BR /&gt;&lt;BR /&gt;Roger</description>
      <pubDate>Sun, 30 Jun 2002 23:45:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/customer-defined-run-cmds/m-p/2755132#M710386</guid>
      <dc:creator>Hanry Zhou</dc:creator>
      <dc:date>2002-06-30T23:45:55Z</dc:date>
    </item>
    <item>
      <title>Re: customer_defined_run_cmds{}</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/customer-defined-run-cmds/m-p/2755133#M710387</link>
      <description>Roger,&lt;BR /&gt;&lt;BR /&gt;These are basically command/functions/programs&lt;BR /&gt;you would run before the package is started.&lt;BR /&gt;&lt;BR /&gt;Say you have configured database in cluster and want to check some services - like monitoring, listener then you can such stuff here.&lt;BR /&gt;&lt;BR /&gt;Regards,</description>
      <pubDate>Sun, 30 Jun 2002 23:51:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/customer-defined-run-cmds/m-p/2755133#M710387</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2002-06-30T23:51:42Z</dc:date>
    </item>
    <item>
      <title>Re: customer_defined_run_cmds{}</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/customer-defined-run-cmds/m-p/2755134#M710388</link>
      <description>The most common use is for commands which monitor the health of a given package.</description>
      <pubDate>Mon, 01 Jul 2002 00:10:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/customer-defined-run-cmds/m-p/2755134#M710388</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-07-01T00:10:54Z</dc:date>
    </item>
    <item>
      <title>Re: customer_defined_run_cmds{}</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/customer-defined-run-cmds/m-p/2755135#M710389</link>
      <description>This is wher eyou would call your own scripts to run your application etc.&lt;BR /&gt;Here is an example of starting/stopping a web servre:&lt;BR /&gt;&lt;BR /&gt;function customer_defined_run_cmds&lt;BR /&gt;{&lt;BR /&gt;# ADD customer defined run commands.&lt;BR /&gt;        /opt/hpwebsuite/ns-enterprise/https-hpwing72/start&lt;BR /&gt;        /opt/hpwebsuite/ns-enterprise/start-admin&lt;BR /&gt;&lt;BR /&gt;        test_return 51&lt;BR /&gt;}&lt;BR /&gt;# This function is a place holder for customer define functions.&lt;BR /&gt;# You should define all actions you want to happen here, before the service is&lt;BR /&gt;# halted.&lt;BR /&gt;&lt;BR /&gt;function customer_defined_halt_cmds&lt;BR /&gt;{&lt;BR /&gt;# ADD customer defined halt commands.&lt;BR /&gt;        /opt/hpwebsuite/ns-enterprise/https-hpwing72/stop&lt;BR /&gt;        /opt/hpwebsuite/ns-enterprise/stop-admin&lt;BR /&gt;        test_return 52&lt;BR /&gt;}&lt;BR /&gt;# END OF CUSTOMER DEFINED FUNCTIONS</description>
      <pubDate>Mon, 01 Jul 2002 06:47:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/customer-defined-run-cmds/m-p/2755135#M710389</guid>
      <dc:creator>melvyn burnard</dc:creator>
      <dc:date>2002-07-01T06:47:36Z</dc:date>
    </item>
    <item>
      <title>Re: customer_defined_run_cmds{}</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/customer-defined-run-cmds/m-p/2755136#M710390</link>
      <description>The important points to mention in the customer_defined_run_cmds{} section is that, the last command before the call to test_return *must* return 0 if the application has started OK, and non-zero if it didn't. So for example if you have a routine that starts you database called start_db.sh which returns 0 on success and 1 on failure you could just do:&lt;BR /&gt;&lt;BR /&gt;function customer_defined_run_cmds &lt;BR /&gt;{ &lt;BR /&gt;# ADD customer defined run commands. &lt;BR /&gt;start_db.sh&lt;BR /&gt;test_return 51 &lt;BR /&gt;} &lt;BR /&gt;&lt;BR /&gt;BUT if your routine didn't return any meaningful return code then perhaps you might want to have another routine that checks the DB started and returned 0 on success:&lt;BR /&gt;&lt;BR /&gt;function customer_defined_run_cmds &lt;BR /&gt;{ &lt;BR /&gt;# ADD customer defined run commands. &lt;BR /&gt;start_db.sh&lt;BR /&gt;check_db_is_up.sh&lt;BR /&gt;test_return 51 &lt;BR /&gt;} &lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;&lt;BR /&gt;Duncan&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 01 Jul 2002 08:40:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/customer-defined-run-cmds/m-p/2755136#M710390</guid>
      <dc:creator>Duncan Edmonstone</dc:creator>
      <dc:date>2002-07-01T08:40:50Z</dc:date>
    </item>
    <item>
      <title>Re: customer_defined_run_cmds{}</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/customer-defined-run-cmds/m-p/2755137#M710391</link>
      <description>Melvyn, Duncan, and others,&lt;BR /&gt;&lt;BR /&gt;1.  Can I start up my applications, ex, start_db.sh in Serivce script, and also monitor these applications in it too. &lt;BR /&gt;&lt;BR /&gt;2.  Why alway return 51, which indicate some errors based on the test_return() function. As Duncan said, you only return non-zero, if you have problem with customer_defined_run_cmds{} function.&lt;BR /&gt;&lt;BR /&gt;Please advice, and points will be assigned.&lt;BR /&gt;&lt;BR /&gt;thanks,&lt;BR /&gt;Roger</description>
      <pubDate>Mon, 01 Jul 2002 14:14:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/customer-defined-run-cmds/m-p/2755137#M710391</guid>
      <dc:creator>Hanry Zhou</dc:creator>
      <dc:date>2002-07-01T14:14:32Z</dc:date>
    </item>
    <item>
      <title>Re: customer_defined_run_cmds{}</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/customer-defined-run-cmds/m-p/2755138#M710392</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;The commands run under this procedure are the ones required to execute / monitor etc for the package application you have configured. These can be anything related to the application package you want to run when the package is starting. &lt;BR /&gt;&lt;BR /&gt;Hope this helps.&lt;BR /&gt;&lt;BR /&gt;Regds&lt;BR /&gt;</description>
      <pubDate>Mon, 01 Jul 2002 14:17:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/customer-defined-run-cmds/m-p/2755138#M710392</guid>
      <dc:creator>Sanjay_6</dc:creator>
      <dc:date>2002-07-01T14:17:30Z</dc:date>
    </item>
    <item>
      <title>Re: customer_defined_run_cmds{}</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/customer-defined-run-cmds/m-p/2755139#M710393</link>
      <description>Roger,&lt;BR /&gt;&lt;BR /&gt;To answer your two questions:&lt;BR /&gt;&lt;BR /&gt;1. Yes you can do this - the great thing about MCSG is that cos large parts of it are based on shell scripts, its easy to change to suit your particular needs. However just because you *can* doesn't mean you *should*. Here's an extract from my MCSG cookbook:&lt;BR /&gt;&lt;BR /&gt;/start quote/&lt;BR /&gt;&lt;BR /&gt;Where Do I Start the Package?&lt;BR /&gt;&lt;BR /&gt;There are two main schools of thought on how to configure application startup and shutdown within a package. These can be broadly summarized as follows:&lt;BR /&gt;&lt;BR /&gt;?? The application is started through a Service. When the service exits because of application failure, starting the service again restarts the application. The customer_defined_run_cmds function in the package control file is left empty.&lt;BR /&gt;?? The application is started from a script defined in the customer_defined_run_cmds function in the package control file. Services monitor components of the application, and attempt to restart any failed component before exiting up to the service restart value. Once the service restart value is reached, the monitor just exits rather than attempting a restart, and ServiceGuard handles package failover to another node.&lt;BR /&gt;&lt;BR /&gt;Both of these approaches are equally viable, but I find the second approach to be more flexible, and allow for additional granularity in terms of application components. &lt;BR /&gt;&lt;BR /&gt;/end quote/&lt;BR /&gt;&lt;BR /&gt;2. I think your misunderstaning the test_return function - the 'test_return 51' and 'test_return 52' aren't saying 'test the value of the return code and the value is 51 or 52' The 51 and 52 are used to tell the control script what to do if the value of $? (the return code from the last command is not zero). Take a look further down your control script and you will find this code fragment:&lt;BR /&gt;&lt;BR /&gt;        if (( $? != 0 ))&lt;BR /&gt;        then&lt;BR /&gt;                case $1 in&lt;BR /&gt;/...snip.../&lt;BR /&gt;                        51)&lt;BR /&gt;                        print "\tERROR:  Function customer_defined_run_cmds"&lt;BR /&gt;                        print "\tERROR:  Failed to RUN customer commands"&lt;BR /&gt;                        halt_services&lt;BR /&gt;                        customer_defined_halt_cmds&lt;BR /&gt;                        disown_dtc&lt;BR /&gt;                        remove_ip_address&lt;BR /&gt;                        umount_fs&lt;BR /&gt;                        deactivate_volume_group&lt;BR /&gt;                        exit 1&lt;BR /&gt;                        ;;&lt;BR /&gt;&lt;BR /&gt;                        52)&lt;BR /&gt;                        print "\tERROR:  Function customer_defined_halt_cmds"&lt;BR /&gt;                        print "\tERROR:  Failed to HALT customer commands"&lt;BR /&gt;                        exit_value=1&lt;BR /&gt;                        ;;&lt;BR /&gt;&lt;BR /&gt;Hope this makes more sense now.&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;&lt;BR /&gt;Duncan</description>
      <pubDate>Tue, 02 Jul 2002 11:23:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/customer-defined-run-cmds/m-p/2755139#M710393</guid>
      <dc:creator>Duncan Edmonstone</dc:creator>
      <dc:date>2002-07-02T11:23:14Z</dc:date>
    </item>
  </channel>
</rss>

