From d01fcb304dd9cdc2e8829f0bcb739475cb5e7f6d Mon Sep 17 00:00:00 2001 From: c9s Date: Fri, 4 Mar 2022 15:29:58 +0800 Subject: [PATCH] doc: add systemd setup procedure --- doc/README.md | 1 + doc/deployment/systemd.md | 42 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 doc/deployment/systemd.md diff --git a/doc/README.md b/doc/README.md index 69284d8e4..4d73b89a9 100644 --- a/doc/README.md +++ b/doc/README.md @@ -15,6 +15,7 @@ ### Deployment * [Helm Chart Deployment](deployment/helm-chart.md) +* [Setting up Systemd](deployment/systemd.md) ### Strategies * [Grid](strategy/grid.md) - Grid Strategy Explanation diff --git a/doc/deployment/systemd.md b/doc/deployment/systemd.md new file mode 100644 index 000000000..87291be7e --- /dev/null +++ b/doc/deployment/systemd.md @@ -0,0 +1,42 @@ +## Setting up Systemd + +If you want to deploy your bbgo binary to a linux system, you could use the systemd to launch your daemon. + +To do this, add service file into the directory `/etc/systemd/system/bbgo.service` with the following content: + +```shell +[Unit] +After=network-online.target +Wants=network-online.target + +[Install] +WantedBy=multi-user.target + +[Service] +WorkingDirectory=/home/bbgo +# KillMode=process +ExecStart=/home/bbgo/bbgo run +User=bbgo +Restart=always +RestartSec=60 +``` + +Then, to load the service file, you need to run: + +```shell +systemctl daemon-reload +``` + +And then you can start your service by running enable and start: + +```shell +systemctl enable bbgo.service +systemctl start bbgo.service +``` + +To stop your service, you can run: + +```shell +systemctl stop bbgo.service +``` +