billw2 / rpi-clone

A shell script to clone a booted disk.
BSD 3-Clause "New" or "Revised" License
2.48k stars 327 forks source link

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

Open folkeorg opened 4 months ago

folkeorg commented 4 months ago

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"