def main(): Script.disableCS() Script.parseCommandLine() args = Script.getPositionalArgs() if len(args) > 2: Script.showHelp(exitCode=1) system = '*' component = '*' if len(args) > 0: system = args[0] if system != '*': if len(args) > 1: component = args[1] # from DIRAC.FrameworkSystem.Client.ComponentInstaller import gComponentInstaller # gComponentInstaller.exitOnError = True # result = gComponentInstaller.runsvctrlComponent(system, component, 'u') if not result['OK']: print('ERROR:', result['Message']) exit(-1) gComponentInstaller.printStartupStatus(result['Value'])
def main(): Script.disableCS() # Registering arguments will automatically add their description to the help menu Script.registerArgument( " System: Name of the system for the component (default *: all)", mandatory=False, default="*") Script.registerArgument( ( "Service: Name of the particular component (default *: all)", "Agent: Name of the particular component (default *: all)", ), mandatory=False, default="*", ) _, args = Script.parseCommandLine() system, component = Script.getPositionalArgs(group=True) from DIRAC.FrameworkSystem.Client.ComponentInstaller import gComponentInstaller if len(args) > 2: Script.showHelp(exitCode=1) if system != "*": if len(args) > 1: component = args[1] gComponentInstaller.exitOnError = True result = gComponentInstaller.runsvctrlComponent(system, component, "d") if not result["OK"]: print("ERROR:", result["Message"]) exit(-1) gComponentInstaller.printStartupStatus(result["Value"])
def export_stopComponent(self, system, component): """ Stop the specified component, running with the runsv daemon """ return gComponentInstaller.runsvctrlComponent(system, component, 'd')
def export_restartComponent(self, system, component): """ Restart the specified component, running with the runsv daemon """ return gComponentInstaller.runsvctrlComponent(system, component, 't')
def export_stopComponent( self, system, component ): """ Stop the specified component, running with the runsv daemon """ return gComponentInstaller.runsvctrlComponent( system, component, 'd' )
def export_restartComponent( self, system, component ): """ Restart the specified component, running with the runsv daemon """ return gComponentInstaller.runsvctrlComponent( system, component, 't' )
Script.setUsageMessage( '\n'.join( [ __doc__.split( '\n' )[1], 'Usage:', ' %s [option|cfgfile] ... [system [service|agent]]' % Script.scriptName, 'Arguments:', ' system: Name of the system for the component (default *: all)', ' service|agent: Name of the particular component (default *: all)' ] ) ) Script.parseCommandLine() args = Script.getPositionalArgs() if len( args ) > 2: Script.showHelp() exit( -1 ) system = '*' component = '*' if len( args ) > 0: system = args[0] if system != '*': if len( args ) > 1: component = args[1] # from DIRAC.FrameworkSystem.Client.ComponentInstaller import gComponentInstaller # gComponentInstaller.exitOnError = True # result = gComponentInstaller.runsvctrlComponent( system, component, 'u' ) if not result['OK']: print 'ERROR:', result['Message'] exit( -1 ) gComponentInstaller.printStartupStatus( result['Value'] )
__doc__.split('\n')[1], 'Usage:', ' %s [option|cfgfile] ... [System [Service|Agent]]' % Script.scriptName, 'Arguments:', ' System: Name of the system for the component (default *: all)', ' Service|Agent: Name of the particular component (default *: all)' ])) Script.parseCommandLine() args = Script.getPositionalArgs() if len(args) > 2: Script.showHelp() exit(-1) system = '*' component = '*' if args: system = args[0] if system != '*': if len(args) > 1: component = args[1] # from DIRAC.FrameworkSystem.Client.ComponentInstaller import gComponentInstaller # gComponentInstaller.exitOnError = True # result = gComponentInstaller.runsvctrlComponent(system, component, 't') if not result['OK']: print('ERROR:', result['Message']) exit(-1) gComponentInstaller.printStartupStatus(result['Value'])