diff --git a/scripts/set_state_ttl.py b/scripts/set_state_ttl.py new file mode 100644 index 00000000..4838fe29 --- /dev/null +++ b/scripts/set_state_ttl.py @@ -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.') diff --git a/scripts/upgrade.sh b/scripts/upgrade.sh index f381a962..8c5cae14 100644 --- a/scripts/upgrade.sh +++ b/scripts/upgrade.sh @@ -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