TLeconte / acarsdec

ACARS SDR decoder
329 stars 88 forks source link

Support for automatic output file rotation #54

Closed szpajder closed 5 years ago

szpajder commented 5 years ago

This patch adds two command line options:

Output file name provided with the -l option gets suffixed automatically with _YYYYMMDD_HH or _YYYYMMDD string, respectively. If the given base file name has an extension suffix starting with a dot, then the extension is moved to the end of the resulting filename. That is, supplying -l /home/pi/acars.log -D options produces a filename of /home/pi/acars_YYYYMMDD.log instead of /home/pi/acars.log_YYYYMMDD. If neither -H nor -D option is used, the program behaves the old way.

An additional change is when the -o 0 option is given together with -l <output_file>, then the output file is not opened nor created at all.

This feature simplifies log file management and archiving by avoiding periodic program restarts, when rotation is required.