Fix PID file for Libra tools.
Using the `lockfile` module didn't produce a PID file that contained the process PID number, just an empty .lck file. Using the TimeoutPIDLockFile distributed with the `daemon` module gives us what we expect: a .pid file with the PID number as the contents.
This commit is contained in:
@@ -14,8 +14,8 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import daemon
|
import daemon
|
||||||
|
import daemon.pidfile
|
||||||
import grp
|
import grp
|
||||||
import lockfile
|
|
||||||
import pwd
|
import pwd
|
||||||
import signal
|
import signal
|
||||||
import sys
|
import sys
|
||||||
@@ -68,7 +68,7 @@ def main():
|
|||||||
context = daemon.DaemonContext(
|
context = daemon.DaemonContext(
|
||||||
working_directory='/etc/haproxy',
|
working_directory='/etc/haproxy',
|
||||||
umask=0o022,
|
umask=0o022,
|
||||||
pidfile=lockfile.FileLock(args.pid),
|
pidfile=daemon.pidfile.TimeoutPIDLockFile(args.pid),
|
||||||
files_preserve=[logger.handlers[0].stream]
|
files_preserve=[logger.handlers[0].stream]
|
||||||
)
|
)
|
||||||
if args.user:
|
if args.user:
|
||||||
|
|||||||
@@ -13,10 +13,10 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import daemon
|
import daemon
|
||||||
|
import daemon.pidfile
|
||||||
import gearman.errors
|
import gearman.errors
|
||||||
import grp
|
import grp
|
||||||
import json
|
import json
|
||||||
import lockfile
|
|
||||||
import pwd
|
import pwd
|
||||||
import socket
|
import socket
|
||||||
from time import sleep
|
from time import sleep
|
||||||
@@ -195,7 +195,7 @@ def main():
|
|||||||
context = daemon.DaemonContext(
|
context = daemon.DaemonContext(
|
||||||
working_directory='/etc/haproxy',
|
working_directory='/etc/haproxy',
|
||||||
umask=0o022,
|
umask=0o022,
|
||||||
pidfile=lockfile.FileLock(args.pid),
|
pidfile=daemon.pidfile.TimeoutPIDLockFile(args.pid),
|
||||||
files_preserve=[logger.handlers[0].stream]
|
files_preserve=[logger.handlers[0].stream]
|
||||||
)
|
)
|
||||||
if args.user:
|
if args.user:
|
||||||
|
|||||||
Reference in New Issue
Block a user