Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Romain Courteaud
slapos
Commits
c19a1ede
Commit
c19a1ede
authored
Apr 01, 2022
by
HongzheWang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
software/matomo:Fix some problem in backup.sh
parent
b701088e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
19 deletions
+26
-19
software/matomo/buildout.hash.cfg
software/matomo/buildout.hash.cfg
+2
-2
software/matomo/matomo-backup.sh.in
software/matomo/matomo-backup.sh.in
+19
-14
software/matomo/matomo-instance.cfg.in
software/matomo/matomo-instance.cfg.in
+2
-1
software/matomo/software.cfg
software/matomo/software.cfg
+3
-2
No files found.
software/matomo/buildout.hash.cfg
View file @
c19a1ede
...
...
@@ -19,8 +19,8 @@ md5sum = 9940e05d5e624a7884f4e6e062355798
[template-matomo-instance]
filename = matomo-instance.cfg.in
md5sum =
5d93bb438971167e7f9f39047cb83821
md5sum =
de40893a14ca624492d47759e75db64a
[template-matomo-backup.sh]
filename = matomo-backup.sh.in
md5sum =
27f4925e3a5b235bdcd3e96117cbfcce
md5sum =
bb0a10cb03dde2a3b43980a6b341f574
software/matomo/matomo-backup.sh.in
View file @
c19a1ede
#!/bin/
ba
sh
#!/bin/sh
set
-e
set
-x
...
...
@@ -13,32 +13,37 @@ if [ ! -f {{ parameter_dict['document-root'] }}/matomo/config/config.ini.php ];
exit
0
;
fi
trap
'rm -rf "$TMPFILE"'
EXIT TERM INT
#we reserve backup folder in a month
find
{{
parameter_dict[
'dir-backup'
]
}}
-mtime
+30 |
xargs
rm
-rf
{{
parameter_dict[
'find_bin'
]
}}
/bin/find
{{
parameter_dict[
'dir-backup'
]
}}
-mtime
+30
-type
d |
{{
parameter_dict[
'find_bin'
]
}}
/bin/
xargs
rm
-rf
#backup
mkdir
{{
parameter_dict[
'dir-backup'
]
}}
/temp
{{
php_bin
}}
{{
parameter_dict[
'document-root'
]
}}
/matomo/console plugin:list
>
{{
parameter_dict[
'dir-backup'
]
}}
/temp/plugins_list
cp
-rf
{{
parameter_dict[
'document-root'
]
}}
/matomo/config
{{
parameter_dict[
'dir-backup'
]
}}
/temp/config
cp
-rf
{{
parameter_dict[
'document-root'
]
}}
/matomo/plugins
{{
parameter_dict[
'dir-backup'
]
}}
/temp/plugins
TMPFILE
=
$(
mktemp
-d
-p
"{{ parameter_dict['dir-backup'] }}"
)
{{
php_bin
}}
{{
parameter_dict[
'document-root'
]
}}
/matomo/console plugin:list
>
$TMPFILE
/plugins_list
cp
-rf
{{
parameter_dict[
'document-root'
]
}}
/matomo/config
$TMPFILE
/config
cp
-rf
{{
parameter_dict[
'document-root'
]
}}
/matomo/plugins
$TMPFILE
/plugins
#check if copy-action finish well
if
test
!
-z
"
$(
diff
-r
{{
parameter_dict[
'dir-backup'
]
}}
/temp/config
{{
parameter_dict[
'document-root'
]
}}
/matomo/config
)
"
;
then
rm
-rf
{{
parameter_dict[
'dir-backup'
]
}}
/temp
if
test
!
-z
"
$(
diff
-r
$TMPFILE
/config
{{
parameter_dict[
'document-root'
]
}}
/matomo/config
)
"
;
then
exit
1
fi
if
test
!
-z
"
$(
diff
-r
{{
parameter_dict[
'dir-backup'
]
}}
/temp
/plugins
{{
parameter_dict[
'document-root'
]
}}
/matomo/plugins
)
"
;
then
rm
-rf
{{
parameter_dict[
'dir-backup'
]
}}
/temp
if
test
!
-z
"
$(
diff
-r
$TMPFILE
/plugins
{{
parameter_dict[
'document-root'
]
}}
/matomo/plugins
)
"
;
then
exit
1
fi
#check if the file plugins_list has been created
if
[
!
-f
{{
parameter_dict[
'dir-backup'
]
}}
/temp
/plugins_list
]
;
then
rm
-rf
{{
parameter_dict[
'dir-backup'
]
}}
/temp
if
[
!
-f
$TMPFILE
/plugins_list
]
;
then
exit
1
fi
#if all things go well, change the name of folder with date now
if
[
-d
{{
parameter_dict[
'dir-backup'
]
}}
/temp
]
;
then
mv
-f
{{
parameter_dict[
'dir-backup'
]
}}
/temp
{{
parameter_dict[
'dir-backup'
]
}}
/
`
date
+%m-%d-%Y-%T
`
if
[
-d
$TMPFILE
]
;
then
mv
-f
$TMPFILE
{{
parameter_dict[
'dir-backup'
]
}}
/
`
date
+%m-%d-%Y-%T
`
fi
exit
0
software/matomo/matomo-instance.cfg.in
View file @
c19a1ede
...
...
@@ -2,6 +2,7 @@
[instance-parameter]
matomo = ${:document-root}
dir-backup = ${directory:backup}
find_bin = {{ findutils_location }}
#php.ini parameters
php.memory_limit = 512M
...
...
@@ -17,7 +18,7 @@ php.max_file_uploads = 100
[php-bin]
recipe = slapos.cookbook:wrapper
wrapper-path = ${directory:bin}/php
command-line = ${instance-parameter:php-bin} -c ${php.ini-conf:rendered}
command-line = ${instance-parameter:php-bin} -c ${php.ini-conf:rendered}
[matomo-backup-cron]
recipe = slapos.cookbook:cron.d
...
...
software/matomo/software.cfg
View file @
c19a1ede
...
...
@@ -5,7 +5,7 @@ extends =
../../stack/lamp/buildout.cfg
# "slapos" stack describes basic things needed for 99.9% of SlapOS Software
../../stack/slapos.cfg
parts =
# Call installation of slapos.cookbook egg defined in stack/slapos.cfg (needed
# in 99,9% of Slapos Software Releases)
...
...
@@ -43,6 +43,7 @@ template = ${:_profile_base_location_}/${:filename}
rendered = ${buildout:directory}/instance-matomo.cfg
extensions = jinja2.ext.do
context =
key findutils_location findutils:location
key gzip_location gzip:location
key python3_location python3:location
key php_location apache-php:location
...
...
@@ -54,7 +55,7 @@ context =
<= matomo-download
# download matomo-backup.sh.in
[template-matomo-backup.sh]
[template-matomo-backup.sh]
<= matomo-download
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