diff options
author | Karel Kočí <cynerd@email.cz> | 2015-11-07 15:35:55 +0100 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2015-11-07 15:35:55 +0100 |
commit | ccc21b09f752d583e3fdca694cd94e61a9fbaa69 (patch) | |
tree | 1cf19174ddcbd39c2dc05557823b5f7d9fc169ec /modules/status.py | |
parent | 2a7c2861b69da4570e90be17ad5e0f36b3ec0527 (diff) | |
download | mcserver-wrapper-ccc21b09f752d583e3fdca694cd94e61a9fbaa69.tar.gz mcserver-wrapper-ccc21b09f752d583e3fdca694cd94e61a9fbaa69.tar.bz2 mcserver-wrapper-ccc21b09f752d583e3fdca694cd94e61a9fbaa69.zip |
Remove modules
Modules are not used any more. They are now useless.
Diffstat (limited to 'modules/status.py')
-rw-r--r-- | modules/status.py | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/modules/status.py b/modules/status.py deleted file mode 100644 index 906c1ec..0000000 --- a/modules/status.py +++ /dev/null @@ -1,71 +0,0 @@ -import os -import sys -import re -import utils -from utils import conf - -services = ( - utils.Service.config, - utils.Service.init, - utils.Service.clean, - utils.Service.parse, - ) - -__STATUSSTRINGS__ = { - 0: "Not running", - 1: "Starting", - 2: "Running", - 3: "Stopping", - } - -def config(conf): - conf.statusFile = conf.folder + '/status' - -def init(): - with open(conf.statusFile, 'w') as f: - f.write(__STATUSSTRINGS__[1]) - -def clean(): - os.remove(conf.statusFile) - -def parse(line): - if ': Done' in line: - __server_start__() - elif ': Stopping the server' in line: - __server_stop__() - else: - return False - return True - -def __server_start__(): - print("Server start.") - with open(conf.statusFile, 'w') as f: - f.write(__STATUSSTRINGS__[2] + '\n') - pass - -def __server_stop__(): - print("Server stop.") - with open(conf.statusFile, 'w') as f: - f.write(__STATUSSTRINGS__[3] + '\n') - pass - -#### For other modules #### -def get_status(conf): - """Returns server status as number. - Requires conf (server configuration) set with identifier using utils.confset(). - Returns: - 0 - Not running - 1 - Starting - 2 - Running - 3 - Stopping - -1 - Unknown status - """ - conf.statusFile = conf.folder + '/status' - if not os.path.exists(conf.statusFile): - return 0 - with open(conf.statusFile, 'r') as f: - status = f.readline().rstrip() - for i in range(len(__STATUSSTRINGS__)): - if __STATUSSTRINGS__[i] == status: - return i - return -1 |