Commit f43baf4a authored by Ad Schellevis's avatar Ad Schellevis

also let configctl wait for configd to start (https://github.com/opnsense/core/issues/218)

parent b282f65d
...@@ -38,10 +38,12 @@ import os.path ...@@ -38,10 +38,12 @@ import os.path
import traceback import traceback
import syslog import syslog
import sys import sys
import time
__author__ = 'Ad Schellevis' __author__ = 'Ad Schellevis'
configd_socket_name = '/var/run/configd.socket' configd_socket_name = '/var/run/configd.socket'
configd_socket_wait = 20
def exec_config_cmd(exec_command): def exec_config_cmd(exec_command):
...@@ -90,6 +92,14 @@ if len(sys.argv) <= 1: ...@@ -90,6 +92,14 @@ if len(sys.argv) <= 1:
sys.exit(0) sys.exit(0)
# check if configd socket exists # check if configd socket exists
# (wait for a maximum of "configd_socket_wait" seconds for configd to start)
i=0
while not os.path.exists(configd_socket_name):
if i >= configd_socket_wait:
break
time.sleep(1)
i += 1
if not os.path.exists(configd_socket_name): if not os.path.exists(configd_socket_name):
print ('configd socket missing (@%s)'%configd_socket_name) print ('configd socket missing (@%s)'%configd_socket_name)
sys.exit(-1) sys.exit(-1)
...@@ -108,3 +118,4 @@ else: ...@@ -108,3 +118,4 @@ else:
if result is None: if result is None:
sys.exit(-1) sys.exit(-1)
print('%s'%(result)) print('%s'%(result))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment