brew服务:在哪里编辑配置?

Mar*_*son 24 mysql homebrew plist

Brew服务已经为mysql安装了这个plist文件.

~ $ brew services list
Name    Status  User      Plist
mysql56 started mh /Users/mh/Library/LaunchAgents/homebrew.mxcl.mysql56.plist
Run Code Online (Sandbox Code Playgroud)

这个文件是否可以安全编辑(即将刷新覆盖此处所做的更改)?我应该用另一种方法来修改文件吗?

Bob*_*lev 29

.plist可以在Cellar目录中找到Formulas附带的所有文件.例如homebrew.mxcl.mysql.plist/usr/local/Cellar/mysql/5.7.14.您可以修改它并   brew services使用它.

或者,您可以修改/Library/LaunchDaemons/homebrew.mxcl.mysql.plist并使其不可变sudo chflags uchg /Library/LaunchDaemons/homebrew.mxcl.mysql.plist.这不允许brew重写或修改.plist文件.

  • [此提交](https://github.com/Homebrew/homebrew-services/pull/332/files#diff-642a732918ee1aeca833e8380816320040a75eb97db5c2743e56e5ad71fc3626L38)之后,您应该使用`brew edit <service>`来更新`plist`方法公式。每次重新启动服务时都会生成 plist 文件。 (4认同)

tau*_*las 8

简短回答:

usr/local/Cellar/编辑+公式名称/+.plist文件中的配置

不在brew services列表中守护进程旁边列出的文件中


长答案:

当您安装公式时,其plist文件位于usr/local/Cellar以公式命名的目录中。

当您使用 生成守护程序时brew services start,该文件将被复制到正在运行的用户的Library/LaunchAgents/,例如:

对于根来说,它是Library/LaunchAgents/

对于普通用户 -~/Library/LaunchAgents

这很重要,更改此文件没有意义,它只是一个副本,下次您以此用户身份运行服务时将被覆盖。

但是,您可以检查此文件以查看该特定服务实例使用了哪些配置。


pno*_*los 6

我(遗憾的是)我不知道你可以编辑哪个文件,但我可以确认编辑Library/LaunchAgents目录中的任何内容都会brew services在下次启动时被覆盖,因此直接编辑它不会有帮助.

  • 但是你可以通过使用`chflags uchg <file>`(以及后来的`chflags nouchg <file>`)来阻止这种情况的发生. (3认同)

Mr *_*ers 5

  1. 复制/Users/mh/Library/LaunchAgents/homebrew.mxcl.mysql56.plist到某处
  2. 更改plist的副本
  3. brew services start mysql56 {path to modified copy of plist file}

  • 对于较新的版本,请注意文件作为最后一个参数已被弃用!使用 `--file=` 来指定 plist 文件。 (2认同)