1

homebrew 添加自定义 services

 1 year ago
source link: https://www.jansora.com/notebook/107565
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

homebrew 添加自定义 services闲文杂记homebrew 添加自定义 services 导航前往主站应用闲文杂记代码在线代码魔方房价浅析

以 rinetd 为例

  1. 确认安装位置
    确认 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

  1. 创建 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%  

  1. 创建 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


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK