From 95c29f73b817523f249f5f0d7945620fcaa75dbe Mon Sep 17 00:00:00 2001 From: Mark <46539611+mark99i@users.noreply.github.com> Date: Wed, 13 May 2020 08:42:59 +0300 Subject: [PATCH 1/2] Script for registering the systemd service --- scripts/reg_systemd_unit.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 scripts/reg_systemd_unit.sh diff --git a/scripts/reg_systemd_unit.sh b/scripts/reg_systemd_unit.sh new file mode 100644 index 0000000..68055f5 --- /dev/null +++ b/scripts/reg_systemd_unit.sh @@ -0,0 +1,32 @@ +#!/bin/bash +SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P) + +cat < /etc/systemd/system/tonnode.service +[Unit] +Description=TON Node service +After=network.target +Wants=network-online.target + +[Service] +Type=simple +WorkingDirectory=$SCRIPT_DIR +ExecStartPre=$SCRIPT_DIR/env.sh && exit 0 +ExecStart=$SCRIPT_DIR/run.sh +RemainAfterExit=yes +StandardOutput=syslog +StandardError=syslog +User=$(whoami) +Group=$(whoami) +Restart=always +RestartSec=120 + +[Install] +WantedBy=multi-user.target +EOLONGFILE + +systemctl daemon-reload + +echo 'DONE' +echo '' +echo 'Use "service tonnode start" for start node' +echo 'Use "systemctl enable tonnode" for add to startup' From 124fa7cbe52a2d916e613b71ef6e6bf9bd1b094c Mon Sep 17 00:00:00 2001 From: Mark <46539611+mark99i@users.noreply.github.com> Date: Wed, 13 May 2020 08:43:18 +0300 Subject: [PATCH 2/2] Script for deleting the systemd service --- scripts/unreg_systemd_unit.sh | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 scripts/unreg_systemd_unit.sh diff --git a/scripts/unreg_systemd_unit.sh b/scripts/unreg_systemd_unit.sh new file mode 100644 index 0000000..a23d4f1 --- /dev/null +++ b/scripts/unreg_systemd_unit.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +service tonnode stop > /dev/null 2>&1 +systemctl disable tonnode > /dev/null 2>&1 +rm /etc/systemd/system/tonnode.service > /dev/null 2>&1 +echo 'DONE'