Appendix to ARCHIVE_NAME in backup script #3

Open
opened 2024-06-08 18:32:23 +00:00 by lingling · 0 comments
Owner

It may be of interest from where the backup does come.

For this it could be possible to add a simple if statement checking for an argument.

ARCHIVE_NAME="$(date --utc '+%Y-%m-%d_%H-%M-%S')"

if [ -n "$1" ]; then
  ARCHIVE_NAME="$(date '+%F')_${1}"
fi

With that the script could be called with /etc/backup/scripts/backup.sh systemd in the systemd unit. The string would be appended to the ARCHIVE_NAME, resulting in the name 2024-06-08_20-32-47_systemd.

It may be of interest from where the backup does come. For this it could be possible to add a simple `if` statement checking for an argument. ```sh ARCHIVE_NAME="$(date --utc '+%Y-%m-%d_%H-%M-%S')" if [ -n "$1" ]; then ARCHIVE_NAME="$(date '+%F')_${1}" fi ``` With that the script could be called with `/etc/backup/scripts/backup.sh systemd` in the systemd unit. The string would be appended to the `ARCHIVE_NAME`, resulting in the name `2024-06-08_20-32-47_systemd`.
lingling changed title from Appendix to ARCHIVE_NAME to Appendix to ARCHIVE_NAME in backup script 2024-06-10 11:24:17 +00:00
lingling added this to the unplanned milestone 2024-06-10 15:37:12 +00:00
Commenting is not possible because the repository is archived.
No milestone
No project
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
ansible-roles/borg#3
No description provided.