-
Notifications
You must be signed in to change notification settings - Fork 0
/
spiffy.py
66 lines (48 loc) · 1.41 KB
/
spiffy.py
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
57
58
59
60
61
62
63
64
65
66
import click
import os
import logging
import coloredlogs
import spiffymanagement
from utils import Config
log = logging.getLogger('spiffymanagement')
coloredlogs.install(level='DEBUG',
logger=log,
fmt='%(asctime)s:%(msecs)03d %(name)s: %(levelname)s %(message)s')
dirp = os.path.dirname(os.path.realpath(__file__))
cfg = Config(f'{dirp}/configs/serverCfgs.toml')
@click.group()
def spiffy():
cfg._load()
@spiffy.command()
@click.argument('server')
def start(server):
spiffymanagement.start(cfg, server)
@spiffy.command()
@click.argument('server')
@click.option('-c', '--countdown')
def stop(server, countdown):
spiffymanagement.stop(cfg, server)
@spiffy.command()
@click.argument('server')
@click.argument('countdown')
def restart(server, countdown):
spiffymanagement.restart(cfg, server, countdown)
@spiffy.command()
@click.argument('server')
def status(server):
spiffymanagement.status(cfg, server)
@spiffy.command()
@click.argument('servers', nargs=-1)
def backup(servers):
for server in servers:
spiffymanagement.backup(cfg, server)
@spiffy.command()
@click.argument('servers', nargs=-1)
def terminate(servers):
for server in servers:
spiffymanagement.terminate(cfg, server)
@spiffy.command()
@click.argument('servers', nargs=-1)
def questbackup(servers):
for server in servers:
spiffymanagement.questbackup(cfg, server)