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' 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'