2019-06-21 Fred Gleason <fredg@paravelsystems.com>

* Added a 'SyslogFacility=' directive to the '[Identity']
	section of rd.conf(5).
	* Added a 'syslog.openlog()' call to the constructor of the
	'PyPAD.Receiver' class.
	* Removed the 'syslog.openlog()' call from the 'pypad_icecast2.py'
	script.
	* Removed the 'syslog.openlog()' call from the 'pypad_live365.py'
	script.
	* Removed the 'syslog.openlog()' call from the 'pypad_serial.py'
	script.
	* Removed the 'syslog.openlog()' call from the 'pypad_shoutcast1.py'
	script.
	* Removed the 'syslog.openlog()' call from the 'pypad_spinitron.py'
	script.
	* Removed the 'syslog.openlog()' call from the 'pypad_tunein.py'
	script.
	* Removed the 'syslog.openlog()' call from the 'pypad_urlwrite.py'
	script.
	* Removed the 'syslog.openlog()' call from the 'pypad_walltime.py'
	script.
	* Removed the 'syslog.openlog()' call from the 'pypad_xcmd.py'
	script.
	* Removed the 'syslog.openlog()' call from the 'pypad_xmpad.py'
	script.
This commit is contained in:
Fred Gleason
2019-06-21 18:57:33 -04:00
parent f30d684644
commit 52dc14a3b3
20 changed files with 102 additions and 73 deletions

View File

@@ -18,6 +18,7 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
import os.path
import configparser
import datetime
import MySQLdb
@@ -25,6 +26,7 @@ import signal
import selectors
import socket
import sys
import syslog
import json
#
@@ -831,6 +833,15 @@ class Receiver(object):
# So we exit cleanly when shutdown by rdpadengined(8)
signal.signal(signal.SIGTERM,SigHandler)
# Open the configuration file
config=configparser.ConfigParser(interpolation=None)
config.readfp(open('/etc/rd.conf'))
# Open the syslog
pypad_name=sys.argv[0].split('/')[-1]
syslog.openlog(pypad_name,logoption=syslog.LOG_PID,facility=config.get('Identity','SyslogFacility',fallback=syslog.LOG_USER))
# Connect to the PAD feed
sock=socket.socket(socket.AF_INET)
conn=sock.connect((hostname,port))
timeout=None