summaryrefslogtreecommitdiff
path: root/python/vyos/util.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/vyos/util.py')
-rw-r--r--python/vyos/util.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/python/vyos/util.py b/python/vyos/util.py
index f2f302559..149deabc4 100644
--- a/python/vyos/util.py
+++ b/python/vyos/util.py
@@ -805,3 +805,12 @@ def boot_configuration_complete() -> bool:
if os.path.isfile(config_status):
return True
return False
+
+def sysctl(name, value):
+ """ Change value via sysctl() - return True if changed, False otherwise """
+ tmp = cmd(f'sysctl {name}')
+ # last list index contains the actual value - only write if value differs
+ if tmp.split()[-1] != str(value):
+ call(f'sysctl -wq {name}={value}')
+ return True
+ return False