Skip to content
Merged
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
30 changes: 30 additions & 0 deletions scripts/set_state_ttl.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import subprocess
import sys

with open('/etc/systemd/system/validator.service', 'r') as file:
service = file.read()


for line in service.split('\n'):
if line.startswith('ExecStart'):
exec_start = line
break


if exec_start.split(' ')[2] != '/usr/bin/ton/validator-engine/validator-engine':
raise Exception('Invalid node start command in service file')


if '--state-ttl 604800' not in exec_start:
print('No state-ttl or custom one found in ExecStart')
sys.exit(0)

new_exec_start = exec_start.replace('--state-ttl 604800', '')

with open('/etc/systemd/system/validator.service', 'w') as file:
file.write(service.replace(exec_start, new_exec_start))

subprocess.run(['systemctl', 'daemon-reload'])
subprocess.run(['systemctl', 'restart', 'validator'])

print('Removed state-ttl from service file.')
8 changes: 8 additions & 0 deletions scripts/upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ cmake -DCMAKE_BUILD_TYPE=Release ${srcdir}/${repo} -GNinja -DTON_USE_JEMALLOC=ON
ninja -j ${cpuNumber} fift validator-engine lite-client pow-miner validator-engine-console generate-random-id dht-server func tonlibjson rldp-http-proxy
systemctl restart validator

if [ -e /usr/src/mytonctrl/scripts/set_state_ttl.py ]
then
/usr/bin/python3 /usr/src/mytonctrl/scripts/set_state_ttl.py
else
echo "Set state ttl script is not found!"
fi


# Конец
echo -e "${COLOR}[1/1]${ENDC} TON components update completed"
exit 0