CC-4114: use liquidsoap shutdown() command to restart liquidsoap
-changed to use init.d script to restart.
This commit is contained in:
parent
1dd1ba4420
commit
72de78bcd1
2 changed files with 7 additions and 18 deletions
|
@ -130,7 +130,7 @@ def liquidsoap_running_test(telnet_lock, host, port, logger):
|
||||||
msg = "version\n"
|
msg = "version\n"
|
||||||
tn.write(msg)
|
tn.write(msg)
|
||||||
tn.write("exit\n")
|
tn.write("exit\n")
|
||||||
logger.info("Liquidsoap version %s", tn.read_all())
|
logger.info("Found: %s", tn.read_all())
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
logger.error(str(e))
|
logger.error(str(e))
|
||||||
success = False
|
success = False
|
||||||
|
|
|
@ -205,22 +205,11 @@ class PypoFetch(Thread):
|
||||||
fh.write("log_file = \"/var/log/airtime/pypo-liquidsoap/<script>.log\"\n");
|
fh.write("log_file = \"/var/log/airtime/pypo-liquidsoap/<script>.log\"\n");
|
||||||
fh.close()
|
fh.close()
|
||||||
|
|
||||||
def stop_liquidsoap(self):
|
def restart_liquidsoap(self):
|
||||||
self.telnet_lock.acquire()
|
|
||||||
try:
|
try:
|
||||||
tn = telnetlib.Telnet(LS_HOST, LS_PORT)
|
subprocess.call('/etc/init.d/airtime-liquidsoap restart', shell=True)
|
||||||
# update the boot up time of liquidsoap. Since liquidsoap is not restarting,
|
|
||||||
# we are manually adjusting the bootup time variable so the status msg will get
|
|
||||||
# updated.
|
|
||||||
tn.write("system.shutdown\n")
|
|
||||||
tn.write('exit\n')
|
|
||||||
|
|
||||||
output = tn.read_all()
|
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
self.logger.error(str(e))
|
self.logger.error(e)
|
||||||
finally:
|
|
||||||
self.telnet_lock.release()
|
|
||||||
|
|
||||||
|
|
||||||
def regenerate_liquidsoap_conf(self, setting):
|
def regenerate_liquidsoap_conf(self, setting):
|
||||||
existing = {}
|
existing = {}
|
||||||
|
@ -232,7 +221,7 @@ class PypoFetch(Thread):
|
||||||
except IOError, e:
|
except IOError, e:
|
||||||
#file does not exist
|
#file does not exist
|
||||||
self.write_liquidsoap_config(setting)
|
self.write_liquidsoap_config(setting)
|
||||||
self.stop_liquidsoap()
|
self.restart_liquidsoap()
|
||||||
|
|
||||||
self.logger.info("Reading existing config...")
|
self.logger.info("Reading existing config...")
|
||||||
# read existing conf file and build dict
|
# read existing conf file and build dict
|
||||||
|
@ -313,7 +302,7 @@ class PypoFetch(Thread):
|
||||||
# rewrite
|
# rewrite
|
||||||
if restart:
|
if restart:
|
||||||
self.write_liquidsoap_config(setting)
|
self.write_liquidsoap_config(setting)
|
||||||
self.stop_liquidsoap()
|
self.restart_liquidsoap()
|
||||||
else:
|
else:
|
||||||
self.logger.info("No change detected in setting...")
|
self.logger.info("No change detected in setting...")
|
||||||
self.update_liquidsoap_connection_status()
|
self.update_liquidsoap_connection_status()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue