Skip to content

Commit 05af918

Browse files
committed
Changed the sudo part and other minor fixes. Also updated README file.
1 parent 4a329c3 commit 05af918

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ On Debian this should do: **sudo apt install pv gzip**
1111

1212
# MySQL/MariaDB
1313
The script will ask for mysql user and password confirmation each time you dump a database.
14-
If this bothers you, then you should create a .my.cnf file.
14+
If this bothers you, then you should create a .my.cnf file (see below) and **also** you should remove "-u root -p" from the mysql commands to avoid trying to connect as root if ***you don't have to***.
15+
1516
## .my.cnf – mysql user & password
1617
Create file ~/.my.cnf and add following lines in it and replace mysqluser & mysqlpass values.
1718
```

fullsysbackup.sh

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
###### Configuration ######
44

5-
# Enter the backup location - Where should we save our files?
5+
# Enter the backup location - Where should we save our files? (You should change this)
66
backuplocation="/home/user/fullsysbackup"
77

8-
# Enter full paths of folders to include in our backup archive.
8+
# Enter full paths of folders to include in our backup archive. (You should change these)
99
backuppaths=(
1010
/home/user
1111
/root
@@ -18,10 +18,10 @@ backuppaths=(
1818
###### End Of Configuration ######
1919

2020
# sudo is required
21-
if [[ $UID != 0 ]]; then
22-
printf "Permission Denied: run this script with sudo privileges. You will also be promped to enter mysql credentials unless you have a .my.cnf file in place. See README.md\n"
23-
printf "sudo $0 $*"
24-
exit 1
21+
printf "\e[1mThis script needs sudo privileges. You will also be promped to enter mysql credentials for each database you export unless you have a .my.cnf file in place. See README.md\e[0m\n"
22+
if [ $EUID != 0 ]; then
23+
sudo "$0" "$@"
24+
exit $?
2525
fi
2626

2727
printf "%b" "\e[1mChecking for required package: pv\e[0m\n"

0 commit comments

Comments
 (0)