Date of clone is not available in log file (solution included) #177

Open
opened 2024-02-19 11:21:36 +01:00 by folkeorg · 0 comments
folkeorg commented 2024-02-19 11:21:36 +01:00 (Migrated from github.com)

Log file output only contains time. If logfile is appendes then there is no way of knowing then previous clones were made. If logfile is over-written then creation of the file tells when clone was made.

However, by appending date to start_time and stop_time, that only are used in the logfile output, the date can be logged too. The duration is still calculated correctly as it uses other variables. The solution is it add %F to date command.

Before:
start_time=date '+%H:%M:%S' (in 2 places)
stop_time=date '+%H:%M:%S'

After:
start_time=date '+%F %H:%M:%S' (in 2 places)
stop_time=date '+%F %H:%M:%S'

Result in logfile:
" Start - 2024-02-19 11:00:37 End - 2024-02-19 11:03:38 Elapsed Time - 3:01"

Log file output only contains time. If logfile is appendes then there is no way of knowing then previous clones were made. If logfile is over-written then creation of the file tells when clone was made. However, by appending date to start_time and stop_time, that only are used in the logfile output, the date can be logged too. The duration is still calculated correctly as it uses other variables. The solution is it add %F to date command. Before: start_time=`date '+%H:%M:%S'` (in 2 places) stop_time=`date '+%H:%M:%S'` After: start_time=`date '+%F %H:%M:%S'` (in 2 places) stop_time=`date '+%F %H:%M:%S'` Result in logfile: " Start - 2024-02-19 11:00:37 End - 2024-02-19 11:03:38 Elapsed Time - 3:01"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Lerking/rpi-clone#177
No description provided.