two days ago,I change my running of zabbix-agent from zabbix_agentd run directly to systemctl start zabbix-agent.There is a weired thing.I write a python script to monitor java GC status, which invoke "sudo".
command jstat is installed with jdk env in the $PATH setting in /etc/profile((/xxx/xxx/bin/jstat,not in/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin)) the two line which python invoke shell command
- jstat = commands.getoutput("which jstat")
- subprocess.Popen(['sudo',jstat, opts, self.pdict['pid']], stdout=subprocess.PIPE)
when using zabbix_agentd directly. commands.getoutput("which jstat") can give value of the abosolutely path to the statement 2.However it is not recognise when running zabbix agent with supervisor.which give a output
what cause this difference between running process directly and systemctl ?