mirror of
https://github.com/YunoHost-Apps/monitorix_ynh.git
synced 2024-09-03 19:46:06 +02:00
Fix backup/restore scripts
This commit is contained in:
parent
4d969072d9
commit
088620b046
2 changed files with 23 additions and 1 deletions
|
@ -32,7 +32,7 @@ mysqldump -u "$dbuser" -p"$dbpass" --no-create-db "$dbname" > ./dump.sql
|
||||||
# Copy NGINX configuration
|
# Copy NGINX configuration
|
||||||
domain=$(ynh_app_setting_get "$app" domain)
|
domain=$(ynh_app_setting_get "$app" domain)
|
||||||
ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "nginx.conf"
|
ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "nginx.conf"
|
||||||
ynh_backup "/etc/nginx/conf.d/monitorix_status.conf" "/monitorix_status.conf"
|
ynh_backup "/etc/nginx/conf.d/monitorix_status.conf" "monitorix_status.conf"
|
||||||
|
|
||||||
# Copy Monitorix configuration
|
# Copy Monitorix configuration
|
||||||
ynh_backup "/etc/monitorix" "config"
|
ynh_backup "/etc/monitorix" "config"
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
|
|
||||||
######## We implement manually this fonctions
|
######## We implement manually this fonctions
|
||||||
|
|
||||||
|
md5sum="7314ad6fcd014a34c2e4e8a95455bcaa"
|
||||||
|
|
||||||
init_script() {
|
init_script() {
|
||||||
# Exit on command errors and treat unset variables as an error
|
# Exit on command errors and treat unset variables as an error
|
||||||
set -eu
|
set -eu
|
||||||
|
@ -18,6 +20,25 @@ init_script() {
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_source() {
|
||||||
|
|
||||||
|
wget -q -O '/tmp/monitorix.deb' 'http://www.monitorix.org/monitorix_3.9.0-izzy1_all.deb'
|
||||||
|
|
||||||
|
if [[ ! -e '/tmp/monitorix.deb' ]] || [[ $(md5sum '/tmp/monitorix.deb' | cut -d' ' -f1) != $md5sum ]]
|
||||||
|
then
|
||||||
|
ynh_die "Error : can't get monitorix debian package"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
CHECK_PATH () { # Vérifie la présence du / en début de path. Et son absence à la fin.
|
||||||
|
if [ "${path:0:1}" != "/" ]; then # Si le premier caractère n'est pas un /
|
||||||
|
path="/$path" # Ajoute un / en début de path
|
||||||
|
fi
|
||||||
|
if [ "${path:${#path}-1}" == "/" ] && [ ${#path} -gt 1 ]; then # Si le dernier caractère est un / et que ce n'est pas le seul caractère.
|
||||||
|
path="${path:0:${#path}-1}" # Supprime le dernier caractère
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
######## End of common fonctions
|
######## End of common fonctions
|
||||||
|
|
||||||
# Init script
|
# Init script
|
||||||
|
@ -63,3 +84,4 @@ sudo cp -a ./config "/etc/monitorix"
|
||||||
|
|
||||||
# Restart webserver
|
# Restart webserver
|
||||||
sudo service nginx reload
|
sudo service nginx reload
|
||||||
|
sudo service monitorix restart
|
Loading…
Add table
Reference in a new issue