mirror of
https://github.com/YunoHost-Apps/monitorix_ynh.git
synced 2024-09-03 19:46:06 +02:00
f92db1b78c
- Update config from upstream - Use Jinja for config file - Dynamically generate config file depending of the auto detected system configuration - Remove dependancy of mysql as it's not needed - Automatically monitor mysql, postgresql, memcached, redis, php pool v>=8.0, fail2ban, mail, partition and network - Add some config parameter in config panel to make easy to change values - Configure alert system (can be enabled by config panel) - Fix small issue linked to previous packaging v2
69 lines
2.3 KiB
Bash
Executable file
69 lines
2.3 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
|
source ../settings/scripts/_common.sh
|
|
source ../settings/scripts/experimental_helper.sh
|
|
source /usr/share/yunohost/helpers
|
|
load_vars
|
|
|
|
#=================================================
|
|
# RESTORE THE DEPENDENCIES
|
|
#=================================================
|
|
ynh_script_progression --message="Restoring the dependencies..." --weight=1
|
|
|
|
install_monitorix_package
|
|
ynh_systemd_action --service_name="$app" --action=stop --log_path=systemd --timeout=15
|
|
mkdir -p /var/log/new_"${app}"
|
|
mv -t /var/log/new_"${app}" /var/log/monitorix*
|
|
mv /var/log/new_"${app}" /var/log/"${app}"
|
|
|
|
ynh_script_progression --message="Configuring databases access..."
|
|
configure_db
|
|
|
|
#=================================================
|
|
# RESTORE SYSTEM CONFIGURATIONS
|
|
#=================================================
|
|
ynh_script_progression --message="Restoring files" --weight=1
|
|
|
|
ynh_restore
|
|
mkdir -p /var/log/$app
|
|
systemctl enable $app.service --quiet
|
|
|
|
ynh_script_progression --message="Configuring php fpm access if needed..."
|
|
if "$phpfpm_installed"; then
|
|
config_php_fpm
|
|
fi
|
|
|
|
yunohost service add $app --description="Monitorix" --log="systemd"
|
|
|
|
#=================================================
|
|
# GENERIC FINALIZATION
|
|
#=================================================
|
|
ynh_script_progression --message="Protecting directory..."
|
|
|
|
set_permission
|
|
|
|
ynh_use_logrotate --logfile "/var/log/$app"
|
|
|
|
#=================================================
|
|
# GENERIC FINALIZATION
|
|
#=================================================
|
|
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
|
|
#=================================================
|
|
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
|
|
|
|
ynh_systemd_action --service_name="$app" --action=start --log_path 'systemd' --line_match ' - Ok, ready.'
|
|
|
|
ynh_systemd_action --service_name=nginx --action=reload
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Restoration completed for $app" --last
|