diff --git a/check_cups b/check_cups index 52cf87c6043f46f2ac8392d2aece28bbc9b284fc..fa6eae0dda760aaeb8e727d70ae3c37509231024 100755 --- a/check_cups +++ b/check_cups @@ -18,7 +18,10 @@ def check_queue(host, queue): worst_user = None 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: ctr = ctr + 1 qid, who, size, when = line.strip().split(None, 3) @@ -49,4 +52,7 @@ def check_queue(host, queue): 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])