summaryrefslogtreecommitdiff
path: root/src/conf_mode
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-11-14 07:57:17 +0100
committerChristian Poessinger <christian@poessinger.com>2020-11-14 07:59:10 +0100
commit95c1942d7e0b811e736e33d2f696a13233ead56c (patch)
treeb8780c7419ce9d381bd8ebed60202920653eee77 /src/conf_mode
parentba483643bd7340960d72dc424e7d57876d99b0cd (diff)
downloadvyos-1x-95c1942d7e0b811e736e33d2f696a13233ead56c.tar.gz
vyos-1x-95c1942d7e0b811e736e33d2f696a13233ead56c.zip
tuned: T3048: programm proper daemon startup
Daemon was only enabled/disabled before and not started/stopped. This has been corrected to start the daemon and wait until startup before sending the configuration profile.
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-xsrc/conf_mode/system-options.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/conf_mode/system-options.py b/src/conf_mode/system-options.py
index 92d60df1b..1061b90ac 100755
--- a/src/conf_mode/system-options.py
+++ b/src/conf_mode/system-options.py
@@ -18,6 +18,7 @@ import os
from netifaces import interfaces
from sys import exit
+from time import sleep
from vyos.config import Config
from vyos.configdict import dict_merge
@@ -77,7 +78,7 @@ def generate(options):
return None
def apply(options):
- # Beep action
+ # System bootup beep
if 'beep_if_fully_booted' in options:
cmd('systemctl enable vyos-beep.service')
else:
@@ -86,17 +87,18 @@ def apply(options):
# Ctrl-Alt-Delete action
if os.path.exists(systemd_action_file):
os.unlink(systemd_action_file)
-
if 'ctrl_alt_del_action' in options:
if options['ctrl_alt_del_action'] == 'reboot':
os.symlink('/lib/systemd/system/reboot.target', systemd_action_file)
elif options['ctrl_alt_del_action'] == 'poweroff':
os.symlink('/lib/systemd/system/poweroff.target', systemd_action_file)
+ # Configure HTTP client
if 'http_client' not in options:
if os.path.exists(curlrc_config):
os.unlink(curlrc_config)
+ # Configure SSH client
if 'ssh_client' not in options:
if os.path.exists(ssh_config):
os.unlink(ssh_config)
@@ -110,10 +112,13 @@ def apply(options):
# tuned - performance tuning
if 'performance' in options:
- cmd('systemctl enable tuned.service')
+ cmd('systemctl restart tuned.service')
+ # wait until daemon has started before sending configuration
+ while (int(os.system('systemctl is-active --quiet tuned.service')) != 0):
+ sleep(0.250)
cmd('tuned-adm profile network-{performance}'.format(**options))
else:
- cmd('systemctl disable tuned.service')
+ cmd('systemctl stop tuned.service')
# Keyboard layout - there will be always the default key inside the dict
# but we check for key existence anyway