Несколько возможных проблем:
Дело в том, что virtualenv не является пакетом (посмотрите на pyinstaller для этого), а скорее среду разработки и тестирования, когда вы переходите к распространению своего кода на новую платформу, тогда, если вы начнете с --no-site-пакетов, вы можете легко узнать, какие пакеты вы используете вам нужно узнать, что вам нужно установить на новую цель.
Итак, в основном - Да, вы, или, скорее всего, системный администратор , делает нужно run pip install flask
и, возможно, несколько других вещей!
ниже может помочь вам начать:
tail -f your_file | while read line
do case "$line" in
*"string_to_search"*) echo "" | mutt -s "Guilty string found" a_mail@mail.com
;;
esac
done
Я использую timeout
для тайм-аута tail
и использую некоторый файл сохранения для сохранения позиции строки, которую мы проанализировали:
# statefile where we save the number of parsed already lines
statefile=/tmp/statefile.txt
# initialize count variable - to zero, or from statefile
if [ -e "$statefile" ]; then
count=$(<"$statefile")
else
count=0
fi
# we timeout for 1 seconds outputting the lines
# the better timeout would be like 10 seconds for big file
# the `tail` command needs to jump `$count` lines inside the input file
timeout 1 tail -n +$count input_log_file |
# tee is used to pass the input to the updating part
tee >(
# read number of parsed lines with `wc -l`
# increment the count of parsed lines and save to statefile
echo $(( count + $(wc -l) )) >"$statefile"
) |
# grep for the searched string
grep --line-buffered string_to_search |
# do the action if string_to_search is found
do_some_action_example_send_mail