Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions scripts/reg_systemd_unit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)

cat <<EOLONGFILE > /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'
6 changes: 6 additions & 0 deletions scripts/unreg_systemd_unit.sh
Original file line number Diff line number Diff line change
@@ -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'