This repository was archived by the owner on Jul 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
44 lines (38 loc) · 1.28 KB
/
main.py
File metadata and controls
44 lines (38 loc) · 1.28 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
#!/usr/bin/python
# coding: utf-8
import os
import sys
import logging
import logging.handlers
import daemon
from local_settings import *
from ceejay import TrelloBot
if __name__ == "__main__":
if len(sys.argv) < 2 or sys.argv[1] not in [
"start", "stop", "restart", "status"]:
print "Usage: %s start|stop|restart|status" % sys.argv[0]
sys.exit()
with daemon.DaemonContext() as daecon:
if sys.argv[1] == "start":
LOGGING_DATE_FORMAT = '%Y%m%d'
logging.basicConfig(
level = logging.DEBUG,
datefmt=LOGGING_DATE_FORMAT
)
root_logger = logging.getLogger('')
logger = logging.handlers.TimedRotatingFileHandler(LOG_DEST,
"midnight", 1)
root_logger.addHandler(logger)
# Create an instance of the bot
trello_bot = TrelloBot()
trello_bot.conectarse()
trello_bot.identificacion_nickserv()
# Start running the bot
trello_bot.start()
elif sys.argv[1] == "stop":
daecon.stop()
elif sys.argv[1] == "restart":
pass
elif sys.argv[1] == "status":
pass
# vim: foldmethod=marker ts=4 sw=4 syn=python expandtab