diff options
| author | Laurent Cozic <laurent@cozic.net> | 2018-03-05 19:29:14 +0000 |
|---|---|---|
| committer | Laurent Cozic <laurent@cozic.net> | 2018-03-05 19:29:14 +0000 |
| commit | 7f1431c13a6b66e40bc3bd0f3c3a7bb6a896fde0 (patch) | |
| tree | bc8eac1ffa82e1ae31a85b15d918be5d746eb8cb /rsync_tmbackup.sh | |
| parent | c5af8528bbdc09fde0a03b3ce270191c3b1b4a96 (diff) | |
Fixed date parsing issue
Diffstat (limited to 'rsync_tmbackup.sh')
| -rwxr-xr-x | rsync_tmbackup.sh | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/rsync_tmbackup.sh b/rsync_tmbackup.sh index cdd3fd1..cb85476 100755 --- a/rsync_tmbackup.sh +++ b/rsync_tmbackup.sh @@ -53,9 +53,6 @@ fn_display_usage() { } fn_parse_date() { - local date_string="$1" - local date_format="$2" - # Converts YYYY-MM-DD-HHMMSS to YYYY-MM-DD HH:MM:SS and then to Unix Epoch. case "$OSTYPE" in linux*) date -d "${1:0:10} ${1:11:2}:${1:13:2}:${1:15:2}" +%s ;; @@ -96,8 +93,7 @@ fn_expire_backups() { # Process each backup dir from most recent to oldest for backup_dir in $(fn_find_backups | sort -r); do local backup_date=$(basename "$backup_dir") - local backup_day=${backup_date:0:10} - local backup_timestamp=$(fn_parse_date $backup_day "Y-m-d") + local backup_timestamp=$(fn_parse_date "$backup_date") # Skip if failed to parse date... if [ -z "$backup_timestamp" ]; then |
