Closed danielkucera closed 5 years ago
Thank you for the suggestion! I'm not very experienced in Linux administration and I'm used to running Zabbix manually, not via systemd
...
So I had to do a bit of research and there seems to be one more option to set environment variable for a service, namely
$ sudo systemctl edit zabbix-server
and typing there something like
[Service]
Environment='EFFLU_CONFIG=/path/to/effluence.conf'
What's your opinion on that?
Hi @i-ky , it depends on how the zabbix is installed. Mine is from zabbix apt repo:
cat /etc/apt/sources.list.d/zabbix.list
deb http://repo.zabbix.com/zabbix/4.0/ubuntu bionic main
deb-src http://repo.zabbix.com/zabbix/4.0/ubuntu bionic main
and it doesn't use systemd config file but an init.d script which loads env vars from /etc/default/zabbix-server
. I cannot say how zabbix is distributed on another systems...
But now I tried your solution and surprisingly it also works.
Ah, I was probably wrong... my system seems to be using systemd service config in fact:
# cat /lib/systemd/system/zabbix-server.service
[Unit]
Description=Zabbix Server
After=syslog.target
After=network.target
[Service]
Environment="CONFFILE=/etc/zabbix/zabbix_server.conf"
EnvironmentFile=-/etc/default/zabbix-server
Type=forking
Restart=on-failure
PIDFile=/run/zabbix/zabbix_server.pid
KillMode=control-group
ExecStart=/usr/sbin/zabbix_server -c $CONFFILE
ExecStop=/bin/kill -SIGTERM $MAINPID
RestartSec=10s
TimeoutSec=infinity
[Install]
WantedBy=multi-user.target
Thank you, @danielkucera, for the information! I need a bit more time to dig in, I want to check how things are on CentOS. There is even a chance that I will be able to completely automate these steps with make install
.
So sorry for a delay...
@danielkucera, please have a look at 2b7f36546cd8dbda98f19e084132e006c10c0d69. Is it OK now? @Rikbiz, I will be glad to hear from you too.
@i-ky it looks good to me
Thank you, @danielkucera! Really appreciate your help.
I'm closing this PR then. Looking forward to more contributions and feedback from you!
instruction how to set envvar on Ubuntu