PATH env variable not loaded in same way with rc.d and service

Hi,

Could someone please explain to me why when I restart service in 2 diffrents way, PATH env is different:

Bash:
root@nocloud ~ $ service zabbix_agentd restart 2>&1  | grep PATH                                                                                         
+ PATH=/sbin:/bin:/usr/sbin:/usr/bin /usr/local/sbin/zabbix_agentd -c /usr/local/etc/zabbix6/zabbix_agentd.conf
root@nocloud ~ $ /usr/local/etc/rc.d/zabbix_agentd restart 2>&1  | grep PATH                                                                             
+ PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin /usr/local/sbin/zabbix_agentd -c /usr/local/etc/zabbix6/zabbix_agentd.conf

I don't understand the difference between service and /usr/local/etc/rc.d.

How can I get the same PATH env with
Code:
service
?

Thanks!
 
service(8):
Code:
ENVIRONMENT
     When used to run rc.d scripts the service command sets HOME to / and PATH
     to /sbin:/bin:/usr/sbin:/usr/bin which is how they are set in /etc/rc at
     boot time.
 
Back
Top