Skip to content

Commit e6f2cb8

Browse files
committed
added log command
1 parent 18a91eb commit e6f2cb8

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

config.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
log_file = "/var/log/pythonms.log"
12
run={
23
"SMTPTester" : {"directory":"SMTPTester", "restart":False, "main_method":"main", "repository":"https://github.com/lupin012345/SMTPTester.git"},
3-
"epitech_api_flask" : {"repository":"https://github.com/lupin012345/epitech-api-public.git", "restart": False, "main_method":"app.run", "directory":"epitechApi", "flask":{"host":"0.0.0.0", "port":8081}}
4+
"epitech_api_flask" : {"repository":"https://github.com/lupin012345/epitech-api-public.git", "restart": False, "main_method":"app.run", "directory":"epitechApi", "flask":{"host":"0.0.0.0", "port":8081}},
5+
"poller" : {"repository":"https://github.com/lupin012345/link_poller.git", "restart": False, "main_method":"main", "directory":"link_poller"}
46
}
57

68
daemon={

modules/commands.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import logging as log
2-
available_commands = ["quit", "list", "start", "kill", "status", "restart", "clear", "keepalive"]
2+
import config
3+
available_commands = ["quit", "list", "start", "kill", "status", "restart", "clear", "keepalive", "log"]
34

45
def handle_input(command, worker, server=None):
56
command = command.strip()
@@ -11,6 +12,11 @@ def handle_input(command, worker, server=None):
1112
output = eval("%s" %command[0])(worker, command, server)
1213
return True, output
1314

15+
def log(worker, args=None, server=None):
16+
with open(config.log_file) as f:
17+
return f.read()
18+
return "Unable to find logfile %s" %config.log_file
19+
1420
def keepalive(worker, args=None, server=None):
1521
if len(args) < 3:
1622
return "You must specify a value. Example : keepalive 1 true"

0 commit comments

Comments
 (0)