Example #1
0
def check_linux_java_1_6_installed():
    """Function for resource in discovery mechanism in preprocess_resources.py.
    """
    if get_platform()!="linux64":
        return False # this resource only valid for ubuntu
    return aptget.is_installed(JVM_APT_PACKAGE)
Example #2
0
"""Management backend for monit"""

import os
import shutil
import engage_utils.process as iuprocess
import engage.utils.file as iufile
import engage.utils.log_setup
import engage.utils.system_info as iusysinfo

logger = engage.utils.log_setup.setup_script_logger(__name__)

monit_exe = '/bin/monit'
if iusysinfo.get_platform() == 'macosx64':
    monit_exe = '/opt/local/bin/monit'

template = \
"""
check process %(processname)s with pidfile %(pidfile)s
  start program = "%(svcctl)s start %(processname)s" with timeout 60 seconds
  stop  program = "%(svcctl)s stop %(processname)s"
  %(dependencies)s"""

def generate_monitrc(svcctl_exe, svc):
    if svc.dependencies == []:
        dependencies = ''
    else:
        dependencies = 'depends on ' + ','.join(svc.dependencies)
    monitor = template % { 'processname' : svc.resource_id,
                 'pidfile'     : svc.pidfile,
                 'dependencies' : dependencies, 
                 'svcctl'       : svcctl_exe