just some coding style fixes
This commit is contained in:
parent
5b09f02d68
commit
b17283b305
1 changed files with 30 additions and 38 deletions
14
linspector
14
linspector
|
|
@ -9,7 +9,6 @@ import logging
|
||||||
import subprocess as sp
|
import subprocess as sp
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def parseArgs():
|
def parseArgs():
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description="Linspector is for monitoring the vital information of hosts, services and devices in a network.",
|
description="Linspector is for monitoring the vital information of hosts, services and devices in a network.",
|
||||||
|
|
@ -26,7 +25,6 @@ def parseArgs():
|
||||||
parser.add_argument("-p", "--pidfile", default="./tmp/linspector.pid", metavar="FILE",
|
parser.add_argument("-p", "--pidfile", default="./tmp/linspector.pid", metavar="FILE",
|
||||||
help="set the pidfile to use (default: /tmp/linspector.pid)")
|
help="set the pidfile to use (default: /tmp/linspector.pid)")
|
||||||
|
|
||||||
|
|
||||||
output = parser.add_mutually_exclusive_group()
|
output = parser.add_mutually_exclusive_group()
|
||||||
output.add_argument("-q", "--quiet", action="store_const", dest="loglevel", const=logging.ERROR,
|
output.add_argument("-q", "--quiet", action="store_const", dest="loglevel", const=logging.ERROR,
|
||||||
help="output only errors")
|
help="output only errors")
|
||||||
|
|
@ -39,6 +37,7 @@ def parseArgs():
|
||||||
output.set_defaults(loglevel=logging.INFO)
|
output.set_defaults(loglevel=logging.INFO)
|
||||||
return parser.parse_args()
|
return parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
args = parseArgs()
|
args = parseArgs()
|
||||||
log = Logger(args.logfile, args.loglevel)
|
log = Logger(args.logfile, args.loglevel)
|
||||||
|
|
@ -55,20 +54,13 @@ def main():
|
||||||
log.i("stopping linspector is currently unsupported")
|
log.i("stopping linspector is currently unsupported")
|
||||||
elif args.action == "restart":
|
elif args.action == "restart":
|
||||||
sp.call("./linspector stop")
|
sp.call("./linspector stop")
|
||||||
sp.call("./linspector start --config " + args.config + " --logfile " + args.logfile + " --pidfile " + args.pidfile)
|
sp.call(
|
||||||
|
"./linspector start --config " + args.config + " --logfile " + args.logfile + " --pidfile " + args.pidfile)
|
||||||
elif args.action == "attach":
|
elif args.action == "attach":
|
||||||
log.i("attaching linspector is currently unsupported")
|
log.i("attaching linspector is currently unsupported")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
log.close()
|
log.close()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue