Skip to content

Instantly share code, notes, and snippets.

@ze-gitan
Last active March 2, 2016 17:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ze-gitan/7c941eef1906d37f0310 to your computer and use it in GitHub Desktop.
Save ze-gitan/7c941eef1906d37f0310 to your computer and use it in GitHub Desktop.
Ambari Custom Service
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>stack.log</name>
<value>/var/log/customService</value>
<description>Log directory</description>
</property>
<property>
<name>zk.home</name>
<value>localhost:2181</value>
<description>Zookeeper URL</description>
</property>
<property>
<name>custom.pid</name>
<value>/var/run/customService</value>
<description>Directory for PID file</description>
</property>
</configuration>
#status stanza only from original master.py
def status(self, env):
import params
env.set_params(params)
check=format("{params.pid_file}/Custom.pid")
check_process_status(check)
#!/usr/bin/env python
from resource_management import *
# server configurations
config = Script.get_config()
zk_home = config['configurations']['hl7-integration-config']['zk.home']
log_level = config['configurations']['hl7-integration-config']['log.level']
pid_file = config['configurations']['hl7-integration-config']['custom.pid']
@abdielou
Copy link

abdielou commented Mar 2, 2016

Change https://gist.github.com/ze-gitan/7c941eef1906d37f0310#file-master_status-py-L6

check=format("{params.pid_file}/Custom.pid")

for

check=format("{pid_file}/Custom.pid")

And if that is still not working then get the path with glob.glob.

check=format("{pid_file}/Custom.pid")
check_process_status(glob.glob(check)[0])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment