使用init.d脚本启动命令和服务启动之间的区别 [英] Difference between starting a command using init.d script and service start

查看:113
本文介绍了使用init.d脚本启动命令和服务启动之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要了解使用 init.d 脚本和服务启动启动命令之间的区别。 p>

例如

之间的区别是什么?

/etc/init.d/nginx start 服务nginx开始

解决方案

他们做同样的事情,除了 service 在受控环境中运行脚本。从服务(8)手册页




服务以尽可能可预测的环境运行System V初始化脚本,删除大多数环境变量和当前
工作目录设置为 /



ENVIRONMENT



LANG TERM

         唯一的环境变量传递到init脚本。



I need to understand the difference between starting a command using init.d script and service start.

For example what is the difference between

/etc/init.d/nginx start and service nginx start.

解决方案

They do the same thing except service runs the script in a controlled environment. From the service(8) man page:

DESCRIPTION

service runs a System V init script in as predictable environment as possible, removing most environment variables and with current working directory set to /.

ENVIRONMENT

LANG, TERM
        The only environment variables passed to the init scripts.

这篇关于使用init.d脚本启动命令和服务启动之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆