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

Latest file name are not cleaned #46

Open
Doooooo0o opened this issue Jan 25, 2021 · 3 comments
Open

Latest file name are not cleaned #46

Doooooo0o opened this issue Jan 25, 2021 · 3 comments

Comments

@Doooooo0o
Copy link

Hey there, I used AutoMySQLBackup with those config lines enabled:

# Store an additional copy of the latest backup to a standard
# location so it can be downloaded by third party scripts.
CONFIG_mysql_dump_latest='yes'

# Remove all date and time information from the filenames in the latest folder.
# Runs, if activated, once after the backups are completed. Practically it just finds all files in the latest folder
# and removes the date and time information from the filenames (if present).
CONFIG_mysql_dump_latest_clean_filenames='yes'

and it results in

$ ls -lahrt |rg 2021.* -o
2021-01-25_10h08m_Monday.sql.gz
2021-01-25_10h08m_Monday.txt.gz
2021-01-25_10h08m_Monday.sql.gz
2021-01-25_10h08m_Monday.sql.gz
2021-01-25_10h08m_Monday.sql.gz
2021-01-25_10h08m_Monday.sql.gz
2021-01-25_10h08m_Monday.sql.gz
2021-01-25_10h08m_Monday.sql.gz
2021-01-25_10h08m_Monday.sql.gz
2021-01-25_10h08m_Monday.sql.gz
2021-01-25_10h08m_Monday.sql.gz
2021-01-25_10h08m_Monday.sql.gz
2021-01-25_10h08m_Monday.sql.gz
2021-01-25_10h08m_Monday.sql.gz
2021-01-25_10h08m_Monday.sql.gz
2021-01-25_10h08m_Monday.sql.gz
2021-01-25_10h08m_Monday.sql.gz
2021-01-25_10h08m_Monday.sql.gz
2021-01-25_10h08m_Monday.sql.gz
2021-01-25_10h08m_Monday.sql.gz
2021-01-25_10h08m_Monday.sql.gz
2021-01-25_10h08m_Monday.sql.gz
2021-01-25_10h08m_Monday.sql.gz
2021-01-25_10h08m_Monday.sql.gz
2021-01-25_10h08m_Monday.sql.gz

am i missing something?

@sktnetwork
Copy link

I can replicate the same issue. Very annoying. It errors at the 'mv' command. The last output looks like this:

Error log below..
mv: '/root/automysqlbackup/latest/status_daily_2021-05-24_17h29m_Monday.txt.gz' and '/root/automysqlbackup/latest/status_daily_2021-05-24_17h29m_Monday.txt.gz' are the same file
mv: '/root/automysqlbackup/latest/fullschema_daily_2021-05-24_17h29m_Monday.sql.gz' and '/root/automysqlbackup/latest/fullschema_daily_2021-05-24_17h29m_Monday.sql.gz' are the same file

@edtjones
Copy link

@theonlydoo @sktnetwork in case you're still looking for a solution to this, the problem is in the expansion of ${sed_Regex} here: https://github.com/sixhop/AutoMySQLBackup/blob/master/automysqlbackup#L317

I haven't resolved the actual problem with this expansion - but in my case I'm only using automysqlbackup on linux so I changed line 317 to look like this:

mv "$1" "$(echo "$1" | sed -re 's/_[0-9]{4}-[0-9]{2}-[0-9]{2}_[0-9]{2}h[0-9]{2}m_(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday|January|February|March|April|May|June|July|August|September|October|November|December|[0-9]{1,2})//g')"


(basically replacing the ${sed_Regex} with the letter r)

@heathharrelson
Copy link

I recently ran into this, and I think the problem is that the $sed_Regex variable is not exported, so it's not set in the subprocess created by find -exec. I was able to fix the issue by exporting $sed_Regex.

# BEGIN Plattform specific configuration
# Check for sed option if osx is used
if [ "`uname -s`" = "Darwin" ]; then
    sed_Regex='E'
	du_opts='-hs'
else
    sed_Regex='r'
	du_opts='-hs --si'
fi
export sed_Regex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants