mirror of
https://github.com/YunoHost-Apps/monitorix_ynh.git
synced 2024-09-03 19:46:06 +02:00
Force add iptables rule for monitorix
While we run yunohost firewall reload the monitorix rules (for stats) are remove. We add a hook to fix that
This commit is contained in:
parent
2c7b930637
commit
dd2a128e76
6 changed files with 22 additions and 1 deletions
6
conf/post_iptable_rules_hook
Normal file
6
conf/post_iptable_rules_hook
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
#/bin/bash
|
||||||
|
|
||||||
|
if [[ $(systemctl status monitorix.service | grep "Active" | cut -d'(' -f2 | cut -d ')' -f1) = 'running' ]]
|
||||||
|
then
|
||||||
|
systemctl restart monitorix.service
|
||||||
|
fi
|
|
@ -52,7 +52,6 @@ config_monitorix() {
|
||||||
ynh_replace_string __MYSQL_USER__ $dbuser $monitorix_conf
|
ynh_replace_string __MYSQL_USER__ $dbuser $monitorix_conf
|
||||||
ynh_replace_string MYSQL_PASSWORD $dbpass $monitorix_conf
|
ynh_replace_string MYSQL_PASSWORD $dbpass $monitorix_conf
|
||||||
cp $monitorix_conf /etc/monitorix/monitorix.conf
|
cp $monitorix_conf /etc/monitorix/monitorix.conf
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
set_permission() {
|
set_permission() {
|
||||||
|
|
|
@ -26,6 +26,9 @@ 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 hook
|
||||||
|
ynh_backup "/usr/share/yunohost/hooks/post_iptable_rules/50-$app"
|
||||||
|
|
||||||
# Copy Monitorix configuration
|
# Copy Monitorix configuration
|
||||||
ynh_backup "/etc/monitorix" "config"
|
ynh_backup "/etc/monitorix" "config"
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,14 @@ config_nginx
|
||||||
# Update monitorix configuration
|
# Update monitorix configuration
|
||||||
config_monitorix
|
config_monitorix
|
||||||
|
|
||||||
|
# Add hook
|
||||||
|
mkdir -p /usr/share/yunohost/hooks/post_iptable_rules
|
||||||
|
cp ../conf/post_iptable_rules_hook /usr/share/yunohost/hooks/post_iptable_rules/50-$app
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC FINALIZATION
|
||||||
|
#=================================================
|
||||||
|
|
||||||
# Set access
|
# Set access
|
||||||
set_permission
|
set_permission
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ ynh_mysql_drop_user "$dbuser" || true
|
||||||
|
|
||||||
# Remove data
|
# Remove data
|
||||||
ynh_secure_remove /var/lib/monitorix
|
ynh_secure_remove /var/lib/monitorix
|
||||||
|
ynh_secure_remove /usr/share/yunohost/hooks/post_iptable_rules/50-$app
|
||||||
|
|
||||||
# Autoremove package
|
# Autoremove package
|
||||||
ynh_remove_app_dependencies
|
ynh_remove_app_dependencies
|
||||||
|
|
|
@ -48,6 +48,10 @@ config_nginx
|
||||||
# Update monitorix configuration
|
# Update monitorix configuration
|
||||||
config_monitorix
|
config_monitorix
|
||||||
|
|
||||||
|
# Add hook
|
||||||
|
mkdir -p /usr/share/yunohost/hooks/post_iptable_rules
|
||||||
|
cp ../conf/post_iptable_rules_hook /usr/share/yunohost/hooks/post_iptable_rules/50-$app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Add table
Reference in a new issue