summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/beep_if_fully_booted.py32
1 files changed, 14 insertions, 18 deletions
diff --git a/src/conf_mode/beep_if_fully_booted.py b/src/conf_mode/beep_if_fully_booted.py
index 1311cba62..f00fcabd0 100755
--- a/src/conf_mode/beep_if_fully_booted.py
+++ b/src/conf_mode/beep_if_fully_booted.py
@@ -17,30 +17,26 @@
#
import sys
-import subprocess
+import os
from vyos.config import Config
from vyos import ConfigError
def get_config():
- conf = Config()
- if not conf.exists('system options beep-if-fully-booted'):
- return 1
- else:
- return 0
+ conf = Config()
+ if not conf.exists('system options beep-if-fully-booted'):
+ return None
+
+ return True
def apply(status):
- if status == 1:
- rc = subprocess.call(['/bin/systemctl -q disable beep'], shell=True)
- return rc
- elif status == 0:
- rc = subprocess.call(['/bin/systemctl -q enable beep'], shell=True)
- return rc
+ if status is not None:
+ os.system('/usr/bin/beep -f 130 -l 100 -n -f 262 -l 100 -n -f 330 -l 100 -n -f 392 -l 100 -n -f 523 -l 100 -n -f 660 -l 100 -n -f 784 -l 300 -n -f 660 -l 300')
if __name__ == '__main__':
- try:
- c = get_config()
- apply(c)
- except ConfigError as e:
- print(e)
- sys.exit(1)
+ try:
+ c = get_config()
+ apply(c)
+ except ConfigError as e:
+ print(e)
+ sys.exit(1)