- Add support for passing PID file name on command line to make it easier to keep system init and daemon configuration in sync.

This commit is contained in:
Scott Kitterman
2019-04-26 20:24:34 -04:00
parent 35745456a2
commit 5ebaf5d848
6 changed files with 13 additions and 6 deletions
+2
View File
@@ -2,6 +2,8 @@
- Add new expand option to setup.py so various file system locations can be - Add new expand option to setup.py so various file system locations can be
specified at build/install time rather than being hard coded specified at build/install time rather than being hard coded
- Install openrc init file for Gentoo and other openrc users - Install openrc init file for Gentoo and other openrc users
- Add support for passing PID file name on command line to make it easier to
keep system init and daemon configuration in sync
1.1.0 2019-04-12 1.1.0 2019-04-12
- Add SubDomains option to enable signing for sub-domains (LP: #1811535) - Add SubDomains option to enable signing for sub-domains (LP: #1811535)
+7 -2
View File
@@ -347,11 +347,16 @@ def main():
privateEd25519 = False privateEd25519 = False
configFile = '/usr/local/etc/dkimpy-milter.conf' configFile = '/usr/local/etc/dkimpy-milter.conf'
if len(sys.argv) > 1: if len(sys.argv) > 1:
if sys.argv[1] in ('-?', '--help', '-h'): if (sys.argv[1] in ('-?', '--help', '-h')) or len(sys.argv) == 3 or \
print('usage: dkimpy-milter [<configfilename>]') (len(sys.argv) == 4 and sys.argv[2] != '-P'):
print('usage: dkimpy-milter [<configfilename>] [-P <pidfile>]')
sys.exit(1) sys.exit(1)
configFile = sys.argv[1] configFile = sys.argv[1]
milterconfig = config._processConfigFile(filename=configFile) milterconfig = config._processConfigFile(filename=configFile)
if len(sys.argv) == 4:
if sys.argv[2] == '-P':
# Command line PID file argument overrides config file
milterconfig['PidFile'] = sys.argv[3]
if milterconfig.get('Syslog'): if milterconfig.get('Syslog'):
facility = eval("syslog.LOG_{0}" facility = eval("syslog.LOG_{0}"
.format(milterconfig.get('SyslogFacility').upper())) .format(milterconfig.get('SyslogFacility').upper()))
+1 -1
View File
@@ -7,7 +7,7 @@ required_files="${CONFFILE}"
command="/usr/local/bin/dkimpy-milter" command="/usr/local/bin/dkimpy-milter"
pidfile="/run/dkimpy-milter/${RC_SVCNAME}.pid" pidfile="/run/dkimpy-milter/${RC_SVCNAME}.pid"
command_args="-P ${pidfile} ${CONFFILE}" command_args="${CONFFILE} -P ${pidfile}"
depend() { depend() {
use dns logger net use dns logger net
+1 -1
View File
@@ -7,7 +7,7 @@ required_files="${CONFFILE}"
command="@BINDIR@/dkimpy-milter" command="@BINDIR@/dkimpy-milter"
pidfile="@RUNSTATEDIR@/${RC_SVCNAME}.pid" pidfile="@RUNSTATEDIR@/${RC_SVCNAME}.pid"
command_args="-P ${pidfile} ${CONFFILE}" command_args="${CONFFILE} -P ${pidfile}"
depend() { depend() {
use dns logger net use dns logger net
+1 -1
View File
@@ -6,7 +6,7 @@ After=network.target
[Service] [Service]
Type=simple Type=simple
PIDFile=/run/dkimpy-milter/dkimpy-milter.pid PIDFile=/run/dkimpy-milter/dkimpy-milter.pid
ExecStart=/usr/local/bin/dkimpy-milter /usr/local/etc/dkimpy-milter/dkimpy-milter.conf ExecStart=/usr/local/bin/dkimpy-milter /usr/local/etc/dkimpy-milter/dkimpy-milter.conf -P /run/dkimpy-milter/dkimpy-milter.pid
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
+1 -1
View File
@@ -6,7 +6,7 @@ After=network.target
[Service] [Service]
Type=simple Type=simple
PIDFile=@RUNSTATEDIR@/dkimpy-milter.pid PIDFile=@RUNSTATEDIR@/dkimpy-milter.pid
ExecStart=@BINDIR@/dkimpy-milter @CONFDIR@/dkimpy-milter.conf ExecStart=@BINDIR@/dkimpy-milter @CONFDIR@/dkimpy-milter.conf -P @RUNSTATEDIR@/dkimpy-milter.pid
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target