Skip to content

Commit bae9c3e

Browse files
committed
Add a usage message like the other executables
1 parent 8267a98 commit bae9c3e

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

supervisor/pidproxy.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python -u
22

3-
""" An executable which proxies for a subprocess; upon a signal, it sends that
4-
signal to the process identified by a pidfile. """
3+
"""pidproxy -- run command and proxy signals to it via its pidfile.
4+
5+
This executable runs a command and then monitors a pidfile. When this
6+
executable receives a signal, it sends the same signal to the pid
7+
in the pidfile.
8+
9+
Usage: %s <pidfile name> <command> [<cmdarg1> ...]
10+
"""
511

612
import os
713
import sys
@@ -10,6 +16,7 @@
1016

1117
class PidProxy:
1218
pid = None
19+
1320
def __init__(self, args):
1421
self.setsignals()
1522
try:
@@ -32,7 +39,7 @@ def go(self):
3239
break
3340

3441
def usage(self):
35-
print("pidproxy.py <pidfile name> <command> [<cmdarg1> ...]")
42+
print(__doc__ % sys.argv[0])
3643

3744
def setsignals(self):
3845
signal.signal(signal.SIGTERM, self.passtochild)
@@ -64,6 +71,3 @@ def main():
6471

6572
if __name__ == '__main__':
6673
main()
67-
68-
69-

0 commit comments

Comments
 (0)