How to read file content and send email on Debian Bullseye

^Bart gabriele1NOSPAM at hotmail.com
Sat Feb 4 10:05:18 EST 2023


Hi guys,

On a Debian Bullseye server I have a lftp upload and after it I should 
send an email.

I thought to read the lftp log file where I have these lines:

2023-01-30 18:30:02 
/home/my_user/local_folder/upload/my_file_30-01-2023_18-30.txt -> 
sftp://ftp_user@ftpserver_ip:2201/remote_ftp_folder/my_file_30-01-2023_18-30.txt 
0-1660576 4.92 MiB/s

2023-02-02 18:30:02 
/home/my_user/local_folder/upload/my_file_02-02-2023_18-30.txt -> 
sftp://ftp_user@ftpserver_ip:2201/remote_ftp_folder/my_file_02-02-2023_18-30.txt 
0-603093 3.39 MiB/s

I'd like to use Python to check, from monday to friday (the lftp script 
runs in crontab from monday to friday) when the upload works is finished 
and I should send an email.

I could read by Python lftp.log and after it if there's a line with the 
same day of the machine I could send an email with ok otherwise the 
email will send a message with "no upload".

How could I do by Python?

Regards.
^Bart


More information about the Python-list mailing list