Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to register a service that is managed by homebrew? #198

Closed
Lyken17 opened this issue Sep 16, 2019 · 1 comment
Closed

How to register a service that is managed by homebrew? #198

Lyken17 opened this issue Sep 16, 2019 · 1 comment
Labels

Comments

@Lyken17
Copy link

Lyken17 commented Sep 16, 2019

For example, the brew service for shadowsocks-libev is

~/Library/LaunchAgents/homebrew.mxcl.shadowsocks-libev.plist

 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
   <dict>
     <key>Label</key>
     <string>homebrew.mxcl.shadowsocks-libev</string>
     <key>ProgramArguments</key>
     <array>
       <string>/usr/local/opt/shadowsocks-libev/bin/ss-local</string>
       <string>-c</string>
       <string>/usr/local/etc/shadowsocks-libev-server.json</string>
       <string>-u</string>
     </array>
     <key>RunAtLoad</key>
     <true/>
     <key>KeepAlive</key>
     <true/>
   </dict>
 </plist>

I want to make a second service (with different configuration) and register to homebrew service. I modified the content and then move to

~/Library/LaunchAgents/homebrew.mxcl.shadowsocks-libev-2.plist

 ......
     <string>homebrew.mxcl.shadowsocks-libev-2</string>
     <key>ProgramArguments</key>
     <array>
       <string>/usr/local/opt/shadowsocks-libev/bin/ss-local</string>
       <string>-c</string>
       <string>/usr/local/etc/shadowsocks-libev-server-2.json</string>
 ......

But it does not show in brew service list neither can be run as brew register run

ligeng@Lgs-Mac-mini➜  LaunchAgents brew services list
Name              Status  User   Plist
shadowsocks-libev started ligeng /Users/ligeng/Library/LaunchAgents/homebrew.mxcl.shadowsocks-libev.plist

ligeng@Lgs-Mac-mini➜  LaunchAgents brew services run shadowsocks-libev-2
Error: No available formula with the name "shadowsocks-libev-2"

How can I register it to brew service?

@MikeMcQuaid
Copy link
Member

How can I register it to brew service?

It needs to be part of a formula.

Instead, just use launchctl directly.

@lock lock bot added the outdated label Jan 1, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Jan 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants