改进 macOS 上 Homebrew 服务安装方式,增加了简单的自查 bug 方式和 Homebrew 脚本报错反馈途径 (#69)

This commit is contained in:
Mrered Cio
2024-05-07 22:14:03 +02:00
committed by GitHub
parent 29fe30eef8
commit b38e3197fc
2 changed files with 63 additions and 28 deletions
+29 -12
View File
@@ -247,19 +247,11 @@ Using Homebrew to install the Agent on macOS
The content of this section is adapted from [🐿️松鼠收集🌰](https://blog.mre.red/archives/install_nezha_monitoring_agent_service_with_homebrew), with the permission of the original author.
* Adding the Homebrew third-party repository
::: danger
Please ensure to set environment variables first, and then proceed with the installation of Nezha-agent using Homebrew!
As the package has not yet been submitted to the official Homebrew Core repository, it is currently available in the third-party Homebrew repository maintained by the author of the blog mentioned above.
```sh
brew tap brewforge/chinese
```
* Installing the Nezha Agent
```sh
brew install nezha-agent
```
Due to the creation of service configuration files (PLIST) by Homebrew during software installation, if you install first and then add environment variables, it will fail to start due to missing parameters!
:::
* Adding environment variables
@@ -269,6 +261,14 @@ echo 'export HOMEBREW_NEZHA_AGENT_SERVER="your server and port, in the format yo
source ~/.zshrc
```
* Installing the Nezha Agent
As the package has not yet been submitted to the official Homebrew Core repository, it is currently available in the [third-party Homebrew repository](https://github.com/Brewforge/homebrew-chinese) maintained by the author of the blog mentioned above.
```sh
brew install brewforge/chinese/nezha-agent
```
* Starting the Nezha Agent service through Homebrew
```sh
@@ -293,6 +293,23 @@ brew services stop nezha-agent
brew rm nezha-agent
```
* Error handling first check environment variables
```sh
echo $HOMEBREW_NEZHA_AGENT_PASSWORD
echo $HOMEBREW_NEZHA_AGENT_SERVER
```
* If the environment variable configuration is correct, attempt reinstallation
```sh
brew services stop nezha-agent
brew reinstall nezha-agent
brew services start nezha-agent
```
* If the issue persists, please proceed to the [third-party Homebrew repository](https://github.com/Brewforge/homebrew-chinese) and submit a ticket
<br/>
### Installing Agent on OpenWRT