mirror of
https://github.com/YunoHost-Apps/zabbix_ynh.git
synced 2024-09-03 20:36:14 +02:00
Update install avoid sed -i
This commit is contained in:
parent
66b7af183a
commit
668435d13d
1 changed files with 8 additions and 23 deletions
|
@ -275,32 +275,17 @@ systemctl reload nginx
|
||||||
### `ynh_replace_string` is used to replace a string in a file.
|
### `ynh_replace_string` is used to replace a string in a file.
|
||||||
### (It's compatible with sed regular expressions syntax)
|
### (It's compatible with sed regular expressions syntax)
|
||||||
ynh_print_info "Generate zabbix config files"
|
ynh_print_info "Generate zabbix config files"
|
||||||
|
confUserPpath=$(find /var/cache/yunohost/ -name "usr_share_zabbix_conf_zabbix.conf.php")
|
||||||
echo "<?php
|
cp "$confServerPath" /usr/share/zabbix/conf/zabbix.conf.php
|
||||||
// Zabbix GUI configuration file.
|
ynh_replace_string --match_string="db_name" --replace_string="$db_name" --target_file=/usr/share/zabbix/conf/zabbix.conf.php
|
||||||
global \$DB;
|
ynh_replace_string --match_string="db_user" --replace_string="$db_user" --target_file=/usr/share/zabbix/conf/zabbix.conf.php
|
||||||
|
ynh_replace_string --match_string="db_pwd" --replace_string="$db_pwd" --target_file=/usr/share/zabbix/conf/zabbix.conf.php
|
||||||
\$DB['TYPE'] = 'MYSQL';
|
|
||||||
\$DB['SERVER'] = 'localhost';
|
|
||||||
\$DB['PORT'] = '0';
|
|
||||||
\$DB['DATABASE'] = '$db_name';
|
|
||||||
\$DB['USER'] = '$db_user';
|
|
||||||
\$DB['PASSWORD'] = '$db_pwd';
|
|
||||||
|
|
||||||
// Schema name. Used for IBM DB2 and PostgreSQL.
|
|
||||||
\$DB['SCHEMA'] = '';
|
|
||||||
|
|
||||||
\$ZBX_SERVER = 'localhost';
|
|
||||||
\$ZBX_SERVER_PORT = '10051';
|
|
||||||
\$ZBX_SERVER_NAME = 'zabbix-server';
|
|
||||||
|
|
||||||
\$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;">/usr/share/zabbix/conf/zabbix.conf.php
|
|
||||||
|
|
||||||
chown -R www-data. /usr/share/zabbix
|
chown -R www-data. /usr/share/zabbix
|
||||||
|
|
||||||
sed -i "s/DBName=zabbix/DBName=$db_name/g" /etc/zabbix/zabbix_server.conf
|
ynh_replace_string --match_string="DBName=zabbix" --replace_string="DBName=$db_name" --target_file=/etc/zabbix/zabbix_server.conf
|
||||||
sed -i "s/DBUser=zabbix/DBUser=$db_user/g" /etc/zabbix/zabbix_server.conf
|
ynh_replace_string --match_string="DBUser=zabbix" --replace_string="DBUser=$db_user" --target_file=/etc/zabbix/zabbix_server.conf
|
||||||
sed -i "126a DBPassword=$db_pwd" /etc/zabbix/zabbix_server.conf
|
ynh_replace_string --match_string="# DBPassword=" --replace_string="# DBPassword=\nDBPassword=$db_pwd" --target_file=/etc/zabbix/zabbix_server.conf
|
||||||
|
|
||||||
ynh_replace_string --match_string="# Timeout=3" --replace_string="# Timeout=3\nTimeout=10" --target_file=/etc/zabbix/zabbix_agentd.conf
|
ynh_replace_string --match_string="# Timeout=3" --replace_string="# Timeout=3\nTimeout=10" --target_file=/etc/zabbix/zabbix_agentd.conf
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue