readme and slight adjustments

This commit is contained in:
David Petric 2023-02-27 09:54:23 +01:00
parent f53b1d381d
commit 35255156bd
2 changed files with 20 additions and 27 deletions

View File

@ -100,4 +100,19 @@ Add the following line to the end of the file:
> 0 12 * * * /path/to/your/script.sh > 0 12 * * * /path/to/your/script.sh
Save and exit the file. Save and exit the file.
## MySQL user 🛢️
If You want to dump all of MySQL databases, read only user is recommended for that action.
It can be created with the following MySQL command:
> GRANT LOCK TABLES, SELECT ON DATABASE_NAME.* TO 'BACKUP_USER'@'%' IDENTIFIED BY 'PASSWORD';
## Buy me a beer 🍻
One pale ale won't hurt, will it ?
0x4046979a1E1152ddbfa4a910b1a98F73625a77ae
ETH / BNB and Polygon chains

30
main.sh
View File

@ -93,21 +93,7 @@ function logbackup {
mkdir -p "$tmpdir/syslogs/" mkdir -p "$tmpdir/syslogs/"
mkdir -p "$tmpdir/syslogs/yum" mkdir -p "$tmpdir/syslogs/yum"
cp -r /var/log/yum/* "$tmpdir/syslogs/yum/" cp -r /var/log/yum/* "$tmpdir/syslogs/yum/"
fi cp -r /var/log/dnf* "$tmpdir/syslogs/yum/"
if [[ " ${log_to_backup[*]} " =~ " ${log_to_backup[auth]} " ]]; then
mkdir -p "$tmpdir/syslogs/"
cp -r /var/log/auth.log "$tmpdir/syslogs/"
fi
if [[ " ${log_to_backup[*]} " =~ " ${log_to_backup[dmesg]} " ]]; then
mkdir -p "$tmpdir/syslogs/"
cp -r /var/log/dmesg "$tmpdir/syslogs/"
fi
if [[ " ${log_to_backup[*]} " =~ " ${log_to_backup[dpkg]} " ]]; then
mkdir -p "$tmpdir/syslogs/"
cp -r /var/log/dpkg.log "$tmpdir/syslogs/"
fi fi
if [[ " ${log_to_backup[*]} " =~ " ${log_to_backup[letsencrypt]} " ]]; then if [[ " ${log_to_backup[*]} " =~ " ${log_to_backup[letsencrypt]} " ]]; then
@ -123,7 +109,7 @@ function logbackup {
if [[ " ${log_to_backup[*]} " =~ " ${log_to_backup[syslog]} " ]]; then if [[ " ${log_to_backup[*]} " =~ " ${log_to_backup[syslog]} " ]]; then
mkdir -p "$tmpdir/syslogs/" mkdir -p "$tmpdir/syslogs/"
cp -r /var/log/syslog "$tmpdir/syslogs/" cp -r /var/log/secure "$tmpdir/syslogs/"
fi fi
if [[ " ${log_to_backup[*]} " =~ " ${log_to_backup[purge]} " ]]; then if [[ " ${log_to_backup[*]} " =~ " ${log_to_backup[purge]} " ]]; then
@ -143,15 +129,7 @@ function logbackup {
fi fi
if [[ " ${log_to_backup[*]} " =~ " ${log_to_backup[pckg_mngr]} " ]]; then if [[ " ${log_to_backup[*]} " =~ " ${log_to_backup[pckg_mngr]} " ]]; then
truncate -s 0 /var/log/yum/* truncate -s 0 /var/log/yum/*
fi truncate -s 0 /var/log/dnf*
if [[ " ${log_to_backup[*]} " =~ " ${log_to_backup[auth]} " ]]; then
truncate -s 0 /var/log/auth.log
fi
if [[ " ${log_to_backup[*]} " =~ " ${log_to_backup[dmesg]} " ]]; then
truncate -s 0 /var/log/dmesg
fi
if [[ " ${log_to_backup[*]} " =~ " ${log_to_backup[dpkg]} " ]]; then
truncate -s 0 /var/log/dpkg.log
fi fi
if [[ " ${log_to_backup[*]} " =~ " ${log_to_backup[letsencrypt]} " ]]; then if [[ " ${log_to_backup[*]} " =~ " ${log_to_backup[letsencrypt]} " ]]; then
truncate -s 0 /var/log/letsencrypt/* truncate -s 0 /var/log/letsencrypt/*
@ -160,7 +138,7 @@ function logbackup {
truncate -s 0 /var/log/php*.log truncate -s 0 /var/log/php*.log
fi fi
if [[ " ${log_to_backup[*]} " =~ " ${log_to_backup[syslog]} " ]]; then if [[ " ${log_to_backup[*]} " =~ " ${log_to_backup[syslog]} " ]]; then
truncate -s 0 /var/log/syslog truncate -s 0 /var/log/secure
fi fi
fi fi
;; ;;