Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Conversation

jsmeix
Copy link
Member

@jsmeix jsmeix commented Dec 17, 2019

On my laptop as in
#2301 (comment)
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 jsmeix added cleanup minor bug An alternative or workaround exists labels Dec 17, 2019
@jsmeix jsmeix added this to the ReaR v2.6 milestone Dec 17, 2019
@jsmeix jsmeix requested a review from a team December 17, 2019 12:30
@jsmeix jsmeix self-assigned this Dec 17, 2019
@jsmeix
Copy link
Member Author

jsmeix commented Dec 17, 2019

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

@jsmeix jsmeix merged commit ae40c5c into rear:master Dec 17, 2019
@jsmeix jsmeix deleted the remove_outdated_root_rear-DATE-TIMESTAMP_log_symlink_issue2301 branch December 17, 2019 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup fixed / solved / done minor bug An alternative or workaround exists
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant