以 rinetd 为例
- 确认安装位置
确认 rinetd 的安装位置/opt/homebrew/Cellar/rinetd/0.73
➜ 0.73 git:(stable) pwd
/opt/homebrew/Cellar/rinetd/0.73
➜ 0.73 git:(stable) ls -l
total 80
-rw-r--r-- 1 jansora admin 3571 Feb 19 2021 CHANGES.md
-rw-r--r-- 1 jansora admin 18431 Feb 19 2021 COPYING
-rw-r--r-- 1 jansora admin 982 Oct 19 10:46 INSTALL_RECEIPT.json
-rw-r--r-- 1 jansora admin 628 Feb 19 2021 README.md
-rw-r--r--@ 1 jansora admin 856 Oct 20 17:22 homebrew.mxcl.rinetd.plist
-rw-r--r-- 1 jansora admin 322 Oct 20 17:23 homebrew.rinetd.service
drwxr-xr-x 3 jansora admin 96 Feb 19 2021 sbin
drwxr-xr-x 4 jansora admin 128 Oct 19 10:46 share
2. 手动创建启动文件
homebrew.mxcl.rinetd.plist
homebrew.rinetd.service
- 创建
homebrew.rinetd.service
[Unit]
Description=Homebrew generated unit for rinetd
[Install]
WantedBy=multi-user.target
[Service]
Type=simple
ExecStart=/opt/homebrew/opt/rinetd/sbin/rinetd -c /opt/homebrew/etc/rinetd.conf -f
Restart=always
StandardOutput=append:/opt/homebrew/var/log/rinetd.log
StandardError=append:/opt/homebrew/var/log/rinetd.log%
- 创建
homebrew.mxcl.rinetd.plist
确保
homebrew.mxcl.rinetd
Label 字段唯一, 否则会报错, 其他的按需修改
<?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>KeepAlive</key>
<true/>
<key>Label</key>
<string>homebrew.mxcl.rinetd</string>
<key>LimitLoadToSessionType</key>
<array>
<string>Aqua</string>
<string>Background</string>
<string>LoginWindow</string>
<string>StandardIO</string>
<string>System</string>
</array>
<key>ProgramArguments</key>
<array>
<string>/opt/homebrew/opt/rinetd/sbin/rinetd</string>
<string>-c</string>
<string>/opt/homebrew/etc/rinetd.conf</string>
<string>-f</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StandardErrorPath</key>
<string>/opt/homebrew/var/log/rinetd.log</string>
<key>StandardOutPath</key>
<string>/opt/homebrew/var/log/rinetd.log</string>
</dict>
</plist>
3. 拷贝文件
这步骤不做其实也行
拷贝文件 homebrew.mxcl.rinetd.plist
至 ~/Library/LaunchAgents/
目录下
大功告成
brew services list