Linux osx 的 /etc/init.d 等效吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15735320/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 22:37:10  来源:igfitidea点击:

osx' s /etc/init.d equivalent?

linuxmacos

提问by user1611830

I am installing gitlab on a mac but this latter is mainly designed for linux os. Following the doc, I have to run this command

我正在 mac 上安装 gitlab,但后者主要是为 linux 操作系统设计的。按照文档,我必须运行此命令

curl --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlab-recipes/master/init.d/gitlab

What is the mac equivalent of the /etc/init.d folder (I know about the launchdcommand but I am looking for the mac's equivalent /etc/init.d folder) ?

/etc/init.d 文件夹的 mac 等价物是什么(我知道这个launchd命令,但我正在寻找 mac 的等价物 /etc/init.d 文件夹)?

回答by ryan

AFAIK, launchdstores its data primarily in .plistfiles in /Library/LaunchAgents/and /Library/LaunchDaemons/, and occasionally in those subdirectories in your home directory. More on those files in this tutorialand this reference.

AFAIKlaunchd将其数据主要.plist存储在/Library/LaunchAgents/和中的文件中/Library/LaunchDaemons/,偶尔存储在主目录中的这些子目录中。有关本教程本参考中这些文件的更多信息。

For your problem specifically, to set launchdup to run gitlab, try converting that init.dscript to a .plistfile with the links above.

对于您的问题,要设置launchd运行 gitlab,请尝试将该init.d脚本转换为.plist具有上述链接的文件。

回答by Morfie

I don't know if you still care about the question or not, but what ryan said is correct. And to directly answer your question, your curl command is trying to download a startup script and put it into your init.d directory. You don't have one, as you are on Mac OS X.

我不知道你是否还关心这个问题,但 ryan 说的是正确的。为了直接回答您的问题,您的 curl 命令正在尝试下载启动脚本并将其放入您的 init.d 目录中。你没有,因为你在 Mac OS X 上。

What you need to do is pop that init.d somewhere else that is permanent. Make sure it is chmod +x and test to see if it works manually. (ie. ./init.d)

您需要做的是将 init.d 弹出到其他永久性的​​地方。确保它是 chmod +x 并测试它是否可以手动工作。(即./init.d)

If it does, you can create a .plist and pop it into /Library/LaunchDaemons/ that will run your init.d file. If your init.d file is as simple as just running an executable, then forget the init.d file entirely, and just have the .plist file run the gitlab executable file directly.

如果是,您可以创建一个 .plist 并将其弹出到 /Library/LaunchDaemons/ 中,该文件将运行您的 init.d 文件。如果你的 init.d 文件就像运行一个可执行文件一样简单,那么完全忘记 init.d 文件,让 .plist 文件直接运行 gitlab 可执行文件。

Either way, I think that you should mark Ryan's (or mine as well) answer as Accepted, as it will solve your issue. The only reason I didn't put this as a comment on Ryan's answer is that my explanation was too long for a comment.

无论哪种方式,我认为您应该将 Ryan(或我的)的答案标记为已接受,因为它会解决您的问题。我没有将其作为对 Ryan 回答的评论的唯一原因是我的解释太长而无法发表评论。