Skip to content
Snippets Groups Projects
Commit 89a5d749 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

check_cups can now invoke lpstat without the -h option.

parent 2f884e5f
No related branches found
No related tags found
No related merge requests found
...@@ -18,7 +18,10 @@ def check_queue(host, queue): ...@@ -18,7 +18,10 @@ def check_queue(host, queue):
worst_user = None worst_user = None
ctr = 0 ctr = 0
fd = os.popen("lpstat -h %s -o %s" % (host, queue)) if host is None:
fd = os.popen("lpstat -o %s" % (queue, ))
else:
fd = os.popen("lpstat -h %s -o %s" % (host, queue))
for line in fd: for line in fd:
ctr = ctr + 1 ctr = ctr + 1
qid, who, size, when = line.strip().split(None, 3) qid, who, size, when = line.strip().split(None, 3)
...@@ -49,4 +52,7 @@ def check_queue(host, queue): ...@@ -49,4 +52,7 @@ def check_queue(host, queue):
if __name__ == '__main__': if __name__ == '__main__':
check_queue(sys.argv[1], sys.argv[2]) if len(sys.argv) == 2:
check_queue(None, sys.argv[1])
else:
check_queue(sys.argv[1], sys.argv[2])
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment