Thursday 28 August 2014

Why use service better than /etc/init.d ?

As sysadmin, i wonder myself about service and /etc/init.d, both are used for controlling process. Thanks to CDH (http://www.cloudera.com/content/cloudera-content/cloudera-docs/CDH5/latest/CDH5-Quick-Start/cdh5qs_prereq.html) I found answer.
This is important because service sets the current working directory to / and removes most environment variables (passing only LANG and TERM) so as to create a predictable environment in which to administer the service. If you run the /etc/init.d scripts directly, any environment variables you have set remain in force, and could produce unpredictable results