Skip to content

Commit f9deb94

Browse files
authored
Merge pull request #266 from yungwine/mytonctrl2_dev
move ls mode creation
2 parents 46e8911 + 03dd9c6 commit f9deb94

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

mytoncore/functions.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ def Event(local, event_name):
5757
enable_ton_storage_provider_event(local)
5858
elif event_name == "enable_liteserver_mode":
5959
enable_liteserver_mode(local)
60-
elif event_name == "enable_validator_mode":
61-
enable_validator_mode(local)
6260
local.exit()
6361
# end define
6462

@@ -95,17 +93,10 @@ def enable_ton_storage_provider_event(local):
9593
#end define
9694

9795

98-
def enable_validator_mode(local):
99-
from mytoninstaller.mytoninstaller import set_node_argument
100-
set_node_argument(local, ['--archive-ttl', '86400']) # limit validator archive ttl to 1 day
101-
102-
10396
def enable_liteserver_mode(local):
104-
from mytoninstaller.mytoninstaller import set_node_argument
10597
ton = MyTonCore(local)
10698
ton.disable_mode('validator')
10799
ton.enable_mode('liteserver')
108-
set_node_argument(local, ['--archive-ttl', '2592000']) # limit liteserver archive ttl to 30 days
109100
#end define
110101

111102

mytoninstaller/settings.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ def FirstNodeSettings(local):
3434
validatorAppPath = local.buffer.validator_app_path
3535
globalConfigPath = local.buffer.global_config_path
3636
vconfig_path = local.buffer.vconfig_path
37+
archive_ttl = 2592000 if local.buffer.mode == 'liteserver' else 86400
3738

3839
# Проверить конфигурацию
3940
if os.path.isfile(vconfig_path):
@@ -57,8 +58,7 @@ def FirstNodeSettings(local):
5758

5859
# Прописать автозагрузку
5960
cpus = psutil.cpu_count() - 1
60-
cmd = "{validatorAppPath} --threads {cpus} --daemonize --global-config {globalConfigPath} --db {ton_db_dir} --logname {tonLogPath} --state-ttl 604800 --verbosity 1"
61-
cmd = cmd.format(validatorAppPath=validatorAppPath, globalConfigPath=globalConfigPath, ton_db_dir=ton_db_dir, tonLogPath=tonLogPath, cpus=cpus)
61+
cmd = f"{validatorAppPath} --threads {cpus} --daemonize --global-config {globalConfigPath} --db {ton_db_dir} --logname {tonLogPath} --state-ttl 604800 --archive-ttl {archive_ttl} --verbosity 1"
6262
add2systemd(name="validator", user=vuser, start=cmd) # post="/usr/bin/python3 /usr/src/mytonctrl/mytoncore.py -e \"validator down\""
6363

6464
# Получить внешний ip адрес
@@ -894,6 +894,7 @@ def EnableMode(local):
894894
args = ["python3", "-m", "mytoncore", "-e"]
895895
if local.buffer.mode == 'liteserver':
896896
args.append("enable_liteserver_mode")
897-
elif local.buffer.mode == 'validator':
898-
args.append("enable_validator_mode")
897+
else:
898+
return
899+
args = ["su", "-l", local.buffer.user, "-c", ' '.join(args)]
899900
subprocess.run(args)

0 commit comments

Comments
 (0)