Compare commits

..

No commits in common. "master" and "test_without_lockfile" have entirely different histories.

8 changed files with 27 additions and 50 deletions

View File

@ -1,23 +0,0 @@
import logging
DEBUG = False
#
# Logging
#
APP_NAME = "file2mail"
LOG_HOSTNAME = "loggy" # When DEBUG is True
LOG_LEVEL = logging.INFO # STDOUT logging
# Folder to be monitored for new files
TARGET_FOLDER = "{{ server_ftp_scan_target_folder }}"
# Recipiant for the files found in TARGET_PATH
SEND_TO = "scan@mount-mockery.de"
# Sender
SEND_FROM = "Scanner <scan@<smtp_server>>"
SMTP_SERVER = "{{ server_ftp_scan_smtp_server }}"
SMTP_USER = "{{ server_ftp_scan_smtp_user }}"
SMTP_PASSWORD = "{{ server_ftp_scan_smtp_password }}"

14
config_example/config.py Normal file
View File

@ -0,0 +1,14 @@
# Folder to be monitored for new files
TARGET_FOLDER = "<target_folder>"
# Recipiant for the files found in TARGET_PATH
SEND_TO = "scan@mount-mockery.de"
# Sender
SEND_FROM = "Scanner <scan@<smtp_server>>"
SMTP_SERVER = "<smtp_server>"
SMTP_USER = "<smtp_user>"
SMTP_PASSWORD = "<smtp_password>"
# Possible log-levels: DEBUG, INFO, WARNING, ERROR
LOG_LEVEL = "INFO"

View File

@ -2,9 +2,11 @@
# -*- coding: UTF-8 -*- # -*- coding: UTF-8 -*-
import config import config
import fstools import fstools
import json
import logging import logging
import mail import mail
import os import os
import psutil
import report import report
import signal import signal
import time import time
@ -12,7 +14,9 @@ import time
CYCLE_TIME = 60 CYCLE_TIME = 60
SLEEP_TIME = .5 SLEEP_TIME = .5
logger = report.default_logging_config() logger = logging.getLogger('root')
report.stdoutLoggingConfigure(log_name_lvl=[('root', config.LOG_LEVEL), ])
class GracefulKiller: class GracefulKiller:
kill_now = False kill_now = False

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/sh
# #
BASEPATH=`dirname $0` BASEPATH=`dirname $0`
$BASEPATH/venv/bin/python $BASEPATH/file2mail.py python $BASEPATH/file2mail.py

@ -1 +1 @@
Subproject commit 9237f6f7f77eed79b8163077c1b4d87189193fbe Subproject commit c10e8792abb05671dab6de51cdadda3bf8ead50f

View File

@ -1,24 +1,8 @@
#!/bin/bash #!/bin/sh
# #
BASEPATH=`realpath $(dirname $0)` BASEPATH=`realpath $(dirname $0)`
# python3 -m venv $BASEPATH/venv
# Create venv $BASEPATH/venv/bin/pip install --upgrade pip
# find $BASEPATH -name requirements.txt | xargs -L 1 $BASEPATH/venv/bin/pip install -r
if [[ ! -e $BASEPATH/venv ]]; then $BASEPATH/venv/bin/pip list --outdated --format=json | jq -r '.[] | .name'|xargs -n1 $BASEPATH/venv/bin/pip install -U
python3 -m venv $BASEPATH/venv > /dev/null 2>&1
# $BASEPATH/venv/bin/pip install --upgrade pip
find $BASEPATH -name requirements.txt | xargs -L 1 $BASEPATH/venv/bin/pip install -r > /dev/null 2>&1
echo "venv changed"
fi
#
# Update venv modules
#
for req_mod in $($BASEPATH/venv/bin/pip list --format=json | jq -r '.[] | .name'); do
$BASEPATH/venv/bin/pip install -U $req_mod | grep install > /dev/null 2>&1
if [[ "$?" -eq "0" ]]; then
echo $req_mod changed
fi
done
#|xargs -n1 $BASEPATH/venv/bin/pip install -U

2
report

@ -1 +1 @@
Subproject commit 60be78310ee6b6a5a091f27f9e5e514927d7520f Subproject commit b53dd30eae1d679b7eec4999bec50aed55bc105b

View File

@ -1,2 +0,0 @@
pathlib
psutil