Menu

[r10367]: / projects / cli / service / cli.py  Maximize  Restore  History

Download this file

57 lines (35 with data), 1.1 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
"""
The service base CLI.
Copyright (c) 2010-2011 iXsystems, Inc., All rights reserved.
See COPYING for more details.
Garrett Cooper, October 2011
"""
from core.cli import CLI
from middleware.callbacks import service_callbacks
class ServiceCLI(CLI):
"""A superclass for managing services."""
def do_configure(self, arg):
"""Configure a service"""
svc = arg[0]
if svc in service_callbacks.get_registered_services():
# TODO: create a mechanism for configuring a service on the fly
# here.
def do_start(self, arg):
"""Start a service"""
svc = arg[0]
service_callbacks.start(svc)
def do_stop(self, arg):
"""Stop a service"""
svc = arg[0]
service_callbacks.stop(svc)
def do_restart(self, arg):
"""Restart a service"""
svc = arg[0]
service_callbacks.restart(svc)
def do_reload(self, arg):
"""Reload a service configuration"""
svc = arg[0]
try:
service_callbacks.reload(svc)
except NotImplementedError:
service_callbacks.restart(svc)
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.