Skip to content

Commit

Permalink
use real scheduler
Browse files Browse the repository at this point in the history
  • Loading branch information
hensur committed Oct 19, 2018
1 parent fc8ff12 commit 6e2d710
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 47 deletions.
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ RUN apt-get update && \
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt

COPY lib ./lib
COPY scansmb.py .

ENTRYPOINT [ "python", "./scansmb.py" ]
43 changes: 0 additions & 43 deletions lib/repeatedtimer.py

This file was deleted.

3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
pysmbc
configargparse
configargparse
apscheduler
6 changes: 4 additions & 2 deletions scansmb.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
import re
from datetime import datetime
import logging
from apscheduler.schedulers.background import BlockingScheduler
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.mime.application import MIMEApplication
import configargparse
import smbc
import lib.repeatedtimer as rt


logging.basicConfig(level=logging.DEBUG)
Expand Down Expand Up @@ -134,7 +134,9 @@ def main():
logger.info(parser.format_values())

loop(ctx, options)
timer = rt.RepeatedTimer(60, loop, ctx, options)
scheduler = BlockingScheduler()
scheduler.add_job(loop, 'interval', minutes=1, args=[ctx, options])
scheduler.start()


if __name__ == "__main__":
Expand Down

0 comments on commit 6e2d710

Please sign in to comment.