summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/system-syslog.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/conf_mode/system-syslog.py b/src/conf_mode/system-syslog.py
index 15533afab..2d47cc061 100755
--- a/src/conf_mode/system-syslog.py
+++ b/src/conf_mode/system-syslog.py
@@ -19,6 +19,7 @@
import sys
import os
import re
+import subprocess
import jinja2
from vyos.config import Config
@@ -313,15 +314,11 @@ def verify(c):
def apply(c):
- if not c and os.path.exists('/var/run/rsyslogd.pid'):
- os.system("sudo systemctl stop syslog.socket")
- os.system("sudo systemctl stop rsyslog")
- else:
- if not os.path.exists('/var/run/rsyslogd.pid'):
- os.system("sudo systemctl start rsyslog >/dev/null")
- else:
- os.system("sudo systemctl restart rsyslog >/dev/null")
+ if not c:
+ subprocess.call(['sudo', 'systemctl', 'stop', 'syslog'])
+ return 0
+ subprocess.call(['sudo', 'systemctl', 'restart', 'syslog'])
if __name__ == '__main__':
try: