From a8c284820bdf485c625bad2fd16fe02fb4c082b0 Mon Sep 17 00:00:00 2001 From: Mostafa Date: Thu, 18 Jun 2026 19:29:13 +0800 Subject: [PATCH] Update systemd tutorial - Remove duplicate 'init' step, mention initialization in the intro - Rephrase intro: after initializing, set up systemd to run Pactus in background - Fix list formatting and indentation --- content/tutorials/linux-systemd.md | 109 +++++++++-------------------- 1 file changed, 35 insertions(+), 74 deletions(-) diff --git a/content/tutorials/linux-systemd.md b/content/tutorials/linux-systemd.md index 3d2df29..d69a5c6 100644 --- a/content/tutorials/linux-systemd.md +++ b/content/tutorials/linux-systemd.md @@ -1,5 +1,5 @@ --- -title: Run Pactus with systemd on Linux +title: Run Pactus as a Systemd Service weight: 11 --- @@ -19,92 +19,53 @@ Before setting up Pactus to run with systemd, ensure you have the following: ## Creating a systemd Service -To create a systemd service for Pactus, follow these steps: +After initializing your Pactus node with `pactus-daemon init`, you can set up +a systemd service to run it in the background. -1. **Initialize the Pactus Node**: Before running the service, initialize the Pactus node with this command: +1. **Create a Service File**: Open a terminal and + create a new service file in the `/etc/systemd/system/` directory with superuser permissions: - ```shell - pactus-daemon init - ``` + ```shell + sudo nano /etc/systemd/system/pactus.service + ``` -2. **Create a Service File**: Open a terminal and - create a new service file in the `/etc/systemd/system/` directory with superuser permissions: +2. **Add the Following Content** to the service file, replacing `` with your actual Linux username: - ```shell - sudo nano /etc/systemd/system/pactus.service - ``` + ```ini + [Unit] + Description=Pactus Daemon Service + After=network.target -3. **Add the Following Content** to the service file, replacing `` with your actual username: + [Service] + Type=simple + User= + ExecStart=/home//pactus-cli/pactus-daemon start -w /home//pactus + Restart=on-failure + RestartSec=10 - ```ini - [Unit] - Description=Pactus Daemon Service - After=network.target + [Install] + WantedBy=multi-user.target + ``` - [Service] - Type=simple - User= - ExecStart=/home//pactus-cli/pactus-daemon start -w /home//pactus - Restart=on-failure - RestartSec=10 - - [Install] - WantedBy=multi-user.target - ``` - -4. **Reload Systemd Configuration**: After creating or modifying the service file, +3. **Reload Systemd Configuration**: After creating or modifying the service file, reload the systemd to recognize the new service: - ```shell - sudo systemctl daemon-reload - ``` - -5. **Start and Enable the Service**: Start the service immediately and enable it to start on boot: - - ```shell - sudo systemctl start pactus - sudo systemctl enable pactus - ``` - -6. **Check Service Status**: Check the status of your service to ensure it is running correctly: - - ```shell - sudo systemctl status pactus - ``` - -## Managing the Service - -Use these commands to manage the Pactus service with systemd: - -- **Start the Service**: - - ```shell - sudo systemctl start pactus - ``` - -- **Stop the Service**: - - ```shell - sudo systemctl stop pactus - ``` - -- **Restart the Service**: - - ```shell - sudo systemctl restart pactus - ``` + ```shell + sudo systemctl daemon-reload + ``` -- **Enable the Service to Start on Boot**: +4. **Start and Enable the Service**: Start the service immediately and enable it to start on boot: - ```shell - sudo systemctl enable pactus - ``` + ```shell + sudo systemctl start pactus + sudo systemctl enable pactus + ``` -- **Disable the Service from Starting on Boot**: +5. **Check Service Status**: Check the status of your service to ensure it is running correctly: - ```shell - sudo systemctl disable pactus - ``` + ```shell + sudo systemctl status pactus + ``` ## Checking Logs