Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Config
Commits
d1c0164a
Commit
d1c0164a
authored
May 08, 2016
by
Igor Pecovnik
Browse files
#3
parent
6e108495
Changes
1
Hide whitespace changes
Inline
Side-by-side
backup and restore/backup.sh
View file @
d1c0164a
...
@@ -23,6 +23,7 @@ function crontab_backup ()
...
@@ -23,6 +23,7 @@ function crontab_backup ()
function
database_backup
()
function
database_backup
()
{
{
if
which mysql
>
/dev/null
;
then
for
db
in
$(
echo
'SHOW DATABASES;'
|mysql
-u
$USER
-p
$PASSWORD
-h
$HOST
|grep
-v
'^Database$'
|grep
-v
"^performance_schema"
|grep
-v
"^information_schema"
|grep
-v
"^mysql"
)
;
for
db
in
$(
echo
'SHOW DATABASES;'
|mysql
-u
$USER
-p
$PASSWORD
-h
$HOST
|grep
-v
'^Database$'
|grep
-v
"^performance_schema"
|grep
-v
"^information_schema"
|grep
-v
"^mysql"
)
;
do
do
mysqldump
\
mysqldump
\
...
@@ -31,6 +32,7 @@ function database_backup ()
...
@@ -31,6 +32,7 @@ function database_backup ()
$db
|
gzip
--best
-c
>
$COPY_TO
/
$DBBACKUPNAME
-
$db
.sql.gz
;
$db
|
gzip
--best
-c
>
$COPY_TO
/
$DBBACKUPNAME
-
$db
.sql.gz
;
echo
-e
"[
\e
[0;32m o.k.
\x
1B[0m]
\e
[1;32m
$1
\x
1B[0mDatabase
$db
backup"
echo
-e
"[
\e
[0;32m o.k.
\x
1B[0m]
\e
[1;32m
$1
\x
1B[0mDatabase
$db
backup"
done
;
done
;
fi
}
}
...
@@ -62,7 +64,7 @@ function conf_backup ()
...
@@ -62,7 +64,7 @@ function conf_backup ()
do
do
[[
-f
$next
||
-d
$next
]]
&&
echo
"
$next
"
>>
$tmpfilename
[[
-f
$next
||
-d
$next
]]
&&
echo
"
$next
"
>>
$tmpfilename
done
done
tar
cvPfz
$COPY_TO
/
$FILEBACKUPNAME
-allfiles
.tgz
-T
$tmpfilename
--exclude
=
'*.sock'
tar
cvPfz
$COPY_TO
/
$FILEBACKUPNAME
-allfiles
.tgz
-T
$tmpfilename
--exclude
=
'*.sock'
&> /dev/null
service samba start
service samba start
service cups start
service cups start
service tvheadend start
service tvheadend start
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment