10

使用 systemd 后台值守运行 Bark

 2 years ago
source link: https://www.ixiqin.com/2021/09/using-systemd-background-unattended-operation-bark/
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

使用 systemd 后台值守运行 Bark

什么是 Bark?

Bark 是由 Fin 开源的一个向 iOS 设备推送通知的服务,Bark 支持自行部署服务端,从而实现消息的推送通过自己的服务器进行,避免与官方的服务共享,提升推送时效。

服务端源码:Finb/bark-server: Backend of Bark (github.com)

客户端源码:Finb/Bark: Bark is an iOS App which allows you to push customed notifications to your iPhone (github.com)

Bark 如何部署?

Bark 的部署非常简单,直接下载官方的 release 文件即可。

下载完成后,你可以执行如下命令来进行测试

bark-server -addr 0.0.0.0:8080 -data ./bark-data

执行成功后,你会看到如下的界面,此时你可以访问 127.0.0.1/ping 来验证你的 Bark 的部署

使用 Systemd 进行值守

验证成功后,接下来就可以设定值守运行了

1. 将 bark server 移动到一个固定目录

首先,你需要将 bark server 移动到一个固定的目录,方便后续执行。

mv bark-server /usr/local/sbin/bark-server

2. 创建 Bark Service

创建 /etc/systemd/system/bark.service 文件,并添加如下内容

[Unit]
Description=Bark Server

[Service]
ExecStart=/usr/local/sbin/bark-server -addr 0.0.0.0:8080 -data /usr/local/bark-data
[Install]
WantedBy=multi-user.target

创建完成后,你可以执行 systemctl status bark 来查看 bark server 的状态。

然后,你就可以使用 systemctl 来控制bark 了

  • 启动服务 systemctl start bark
  • 停止服务 systemctl stop bark
  • 查看服务状态 systemctl status bark
发布日期:2021年9月21日
分类:工程化
d9b147a3b7e8d89bf4a5ddd0518bca30?s=85&d=monsterid&r=g

作者:白 宦成

Generalist, contact me at [email protected]

查看白 宦成的所有文章。

发表评论 取消回复

您的电子邮箱地址不会被公开。 必填项已用*标注

评论

显示名称 *

电子邮箱地址 *

网站地址


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK