{"id":730,"date":"2010-08-27T17:41:28","date_gmt":"2010-08-27T22:41:28","guid":{"rendered":"http:\/\/appcrawler.com\/wordpress\/?p=730"},"modified":"2011-07-06T10:11:09","modified_gmt":"2011-07-06T15:11:09","slug":"a-simple-example-of-a-custom-component-managed-by-crs","status":"publish","type":"post","link":"http:\/\/appcrawler.com\/wordpress\/2010\/08\/27\/a-simple-example-of-a-custom-component-managed-by-crs\/","title":{"rendered":"A simple example of a custom component managed by CRS"},"content":{"rendered":"<p>You can add custom components to CRS if you have a need.  You basically need a program (perhaps as simple as a shell script) that accepts three command line arguments:<\/p>\n<ul>\n<li>start<\/li>\n<li>stop<\/li>\n<li>check<\/li>\n<\/ul>\n<p>Below is an example of a shell script that you can register.<\/p>\n<pre lang=\"text\" line=\"1\">\r\n#!\/bin\/sh\r\n\r\nif [ \"$1\" = \"start\" ]; then\r\n  \/home\/oracle\/test &amp;\r\nelif [ \"$1\" = \"stop\" ]; then\r\n  PID=$(ps -ef | grep \"\/home\/oracle\/test\" | grep -v grep | awk '{print $2}')\r\n  if [ $PID ]; then\r\n    kill -9 $PID\r\n  fi\r\n  exit 0\r\nelif [ \"$1\" = \"check\" ]; then\r\n  ps -ef | grep \"\/home\/oracle\/test\" | grep -v grep  | grep -v check &gt; \/dev\/null\r\n  RETURN=$?\r\n  exit $RETURN\r\nfi<\/pre>\n<p>&#8230;with the program below called by the script above&#8230;<\/p>\n<pre lang=\"text\" line=\"1\">\r\n#!\/bin\/sh\r\n\r\nwhile true; do\r\n  echo 1\r\n  sleep 5\r\ndone<\/pre>\n<p>You can then register the program by creating the following resource profile in a file named oclc.linux1.test.cap in the current directory&#8230;<\/p>\n<pre>NAME=oclc.linux1.test\r\nTYPE=application\r\nACTION_SCRIPT=\/home\/oracle\/test.sh\r\nACTIVE_PLACEMENT=0\r\nAUTO_START=1\r\nCHECK_INTERVAL=30\r\nDESCRIPTION=test application\r\nFAILOVER_DELAY=0\r\nFAILURE_INTERVAL=0\r\nFAILURE_THRESHOLD=0\r\nHOSTING_MEMBERS=linux1\r\nOPTIONAL_RESOURCES=\r\nPLACEMENT=restricted\r\nRESTART_ATTEMPTS=20\r\nSCRIPT_TIMEOUT=30\r\nSTART_TIMEOUT=0\r\nSTOP_TIMEOUT=0\r\nUPTIME_THRESHOLD=7d<\/pre>\n<p>&#8230;which you finally register with the clusterware as follows&#8230;<\/p>\n<pre lang=\"text\" line=\"1\">\r\ncrs_register oclc.linux1.test -dir $(pwd)\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>You can add custom components to CRS if you have a need. You basically need a program (perhaps as simple as a shell script) that accepts three command line arguments: start stop check Below is an example of a shell&hellip;<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"http:\/\/appcrawler.com\/wordpress\/2010\/08\/27\/a-simple-example-of-a-custom-component-managed-by-crs\/\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"footnotes":""},"categories":[19,22],"tags":[],"_links":{"self":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/730"}],"collection":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/comments?post=730"}],"version-history":[{"count":18,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/730\/revisions"}],"predecessor-version":[{"id":974,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/730\/revisions\/974"}],"wp:attachment":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/media?parent=730"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/categories?post=730"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/tags?post=730"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}