#2302 PR merged: Remove outdated /root/rear-DATE-TIMESTAMP.log symlinks (issue#2301)

Labels: cleanup, fixed / solved / done, minor bug

jsmeix opened issue at 2019-12-17 12:30:

On my laptop as in
https://github.com/rear/rear/issues/2301#issue-537544483
I did a third "rear -D recover" and now I have in the log

+ source /usr/share/rear/wrapup/default/990_copy_logfile.sh
...
++ for log_file_symlink in $recovery_system_roots_home_dir/rear-[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9]*.log
++ test -L /mnt/local/root/rear-2019-12-11T17:26:13+01:00.log
+++ readlink -m /mnt/local/root/rear-2019-12-11T17:26:13+01:00.log
++ test /var/log/rear/recover/rear-linux-88cr.log = /var/log/rear/recover/rear-linux-88cr.log
++ rm --verbose /mnt/local/root/rear-2019-12-11T17:26:13+01:00.log
removed '/mnt/local/root/rear-2019-12-11T17:26:13+01:00.log'
++ for log_file_symlink in $recovery_system_roots_home_dir/rear-[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9]*.log
++ test -L /mnt/local/root/rear-2019-12-12T14:23:30+01:00.log
+++ readlink -m /mnt/local/root/rear-2019-12-12T14:23:30+01:00.log
++ test /var/log/rear/recover/rear-linux-88cr.log = /var/log/rear/recover/rear-linux-88cr.log
++ rm --verbose /mnt/local/root/rear-2019-12-12T14:23:30+01:00.log
removed '/mnt/local/root/rear-2019-12-12T14:23:30+01:00.log'
++ for log_file_symlink in $recovery_system_roots_home_dir/rear-[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9]*.log
++ test -L /mnt/local/root/rear-2019-12-17T11:44:27+01:00.log
+++ readlink -m /mnt/local/root/rear-2019-12-17T11:44:27+01:00.log
++ test /var/log/rear/recover/rear-linux-88cr.log = /var/log/rear/recover/rear-linux-88cr.log
++ rm --verbose /mnt/local/root/rear-2019-12-17T11:44:27+01:00.log
removed '/mnt/local/root/rear-2019-12-17T11:44:27+01:00.log'
+++ date -Iseconds
++ log_file_symlink=/mnt/local/root/rear-2019-12-17T12:01:38+01:00.log
++ ln --verbose -s /var/log/rear/recover/rear-linux-88cr.log /mnt/local/root/rear-2019-12-17T12:01:38+01:00.log
'/mnt/local/root/rear-2019-12-17T12:01:38+01:00.log' -> '/var/log/rear/recover/rear-linux-88cr.log'

so that I have now in the rescreated system
only one valid symlink to the recent log file:

# ls -lhtr /root/rear-*
lrwxrwxrwx 1 root root 41 Dec 17 12:01 /root/rear-2019-12-17T12:01:38+01:00.log -> /var/log/rear/recover/rear-linux-88cr.log

# ls -l /var/log/rear/recover/rear-linux-88cr.log
-rw-r--r-- 1 root root 121681 Dec 17 12:01 /var/log/rear/recover/rear-linux-88cr.log
  • Brief description of the changes in this pull request:

Before creating the current symlink test all files
that match the file name pattern of such symlinks
and remove those already existing symlinks where
the target is the current rear log file.

jsmeix commented at 2019-12-17 12:50:

@rear/contributors
when there are no objections
I would like to "just merge" it a bit later today.


[Export of Github issue for rear/rear.]