Changeset 1467 for trunk


Ignore:
Timestamp:
Feb 13, 2010, 5:36:36 PM (15 years ago)
Author:
gdb
Message:
Minor hacron fixes
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/server/common/oursrc/hacron/hacron

    r1466 r1467  
    11#!/usr/bin/env python
     2from __future__ import with_statement
    23import glob
    34import logging.handlers
     
    2930        self.errno = errno
    3031        self.msg = msg
     32        logger.error(msg)
    3133   
    3234class HaLogHandler(logging.Handler):
     
    8082
    8183def _remove(dest):
     84    if not path.exists(dest) and not path.islink(dest):
     85        logger.info('Tried to remove nonexistant path %s' % dest)
     86        return True
     87
    8288    try:
    8389        if path.isdir(dest):
     
    128134    else:
    129135        cmd = ['service', 'crond', 'reload']
    130     subprocess.check_call(cmd)
     136    try:
     137        subprocess.check_call(cmd)
     138    except OSError, e:
     139        raise HacronError(OCF_ERR_GENERIC, 'Cron restart exited with return code %d' % e.errno)
     140    else:
     141        logger.info('Restarted crond')
    131142
    132143def start_cron(args, options):
     
    155166                logger.info('Created slave dummy directory %s' % crondir)
    156167    try:
    157         _restart_crond()
     168        _restart_crond(args, options)
    158169    except OSError, e:
    159         logger.error('Cron restart exited with return code %d' % e.errno)
    160         return OCF_ERR_GENERIC
    161     else:
    162         logger.info('Restarted crond')
     170        return e.errno
    163171    return OCF_SUCCESS
    164172
     
    175183        # TODO: should we do something else here?
    176184        try:
    177             _restart_crond()
     185            _restart_crond(args, options)
    178186        except OSError, e:
    179             logger.error('Cron restart exited with return code %d' % e.errno)
    180             return OCF_ERR_GENERIC
    181         else:
    182             logger.info('Restarted crond')
     187            return e.errno
    183188        return OCF_SUCCESS
    184189
     
    276281
    277282def main():
    278     usage_str = """usage: %%prog [-s server] [-c cronroot] [-d] cmd
     283    usage_str = """usage: %prog [-s server] [-c cronroot] [-d] cmd
    279284
    280285Script for starting and stopping cron in a multiserver environment.
     
    320325        _set_globals(args, options)
    321326    except HacronError, e:
    322         logger.error(e.msg)
    323327        return e.errno
    324328
Note: See TracChangeset for help on using the changeset viewer.