initial commit after bringing over cleaned up code and testing some examples
This commit is contained in:
parent
c4858e6e0d
commit
00f4ebf5a9
93 changed files with 15189 additions and 13083 deletions
|
@ -1,23 +1,27 @@
|
|||
from core.service import CoreService, addservice
|
||||
from sys import maxint
|
||||
from inspect import isclass
|
||||
from sys import maxint
|
||||
|
||||
from core.service import CoreService
|
||||
from core.service import ServiceManager
|
||||
|
||||
|
||||
class Startup(CoreService):
|
||||
'A CORE service to start other services in order, serially'
|
||||
"""
|
||||
A CORE service to start other services in order, serially
|
||||
"""
|
||||
_name = 'startup'
|
||||
_group = 'Utility'
|
||||
_depends = ()
|
||||
_dirs = ()
|
||||
_configs = ('startup.sh', )
|
||||
_configs = ('startup.sh',)
|
||||
_startindex = maxint
|
||||
_startup = ('sh startup.sh', )
|
||||
_startup = ('sh startup.sh',)
|
||||
_shutdown = ()
|
||||
_validate = ()
|
||||
|
||||
@staticmethod
|
||||
def isStartupService(s):
|
||||
return isinstance(s, Startup) or \
|
||||
(isclass(s) and issubclass(s, Startup))
|
||||
def is_startup_service(s):
|
||||
return isinstance(s, Startup) or (isclass(s) and issubclass(s, Startup))
|
||||
|
||||
@classmethod
|
||||
def generateconfig(cls, node, filename, services):
|
||||
|
@ -26,12 +30,14 @@ class Startup(CoreService):
|
|||
script = '#!/bin/sh\n' \
|
||||
'# auto-generated by Startup (startup.py)\n\n' \
|
||||
'exec > startup.log 2>&1\n\n'
|
||||
for s in sorted(services, key = lambda x: x._startindex):
|
||||
if cls.isStartupService(s) or len(str(s._starttime)) > 0:
|
||||
for s in sorted(services, key=lambda x: x._startindex):
|
||||
if cls.is_startup_service(s) or len(str(s._starttime)) > 0:
|
||||
continue
|
||||
start = '\n'.join(s.getstartup(node, services))
|
||||
if start:
|
||||
script += start + '\n'
|
||||
return script
|
||||
|
||||
addservice(Startup)
|
||||
|
||||
def load_services():
|
||||
ServiceManager.add(Startup)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue