From: Bernard Blackham Date: Sun, 12 Dec 2004 06:51:06 +0000 (+0000) Subject: create pipe idler X-Git-Tag: IMPORT-FROM-UCCCVS~49 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=d74d41f237a7a1e19c69e704935071b1b9042655;p=uccvend-vendserver.git create pipe idler --- diff --git a/sql-edition/servers/Idler.py b/sql-edition/servers/Idler.py index 5fe61cf..2670b51 100755 --- a/sql-edition/servers/Idler.py +++ b/sql-edition/servers/Idler.py @@ -247,6 +247,19 @@ class FortuneIdler(StringIdler): def affinity(self): return 20 +class PipeIdler(StringIdler): + def __init__(self, v, command): + text = "I ate my cookie...." + if os.access(command,os.F_OK|os.X_OK): + (stdout, stdin) = popen2.popen2(command) + text = string.join(stdout.readlines()) + stdout.close() + stdin.close() + StringIdler.__init__(self, v, text,repeat=False) + + def affinity(self): + return 20 + class FileIdler(StringIdler): def __init__(self, v, thefile=None, repeat=False): text = "I broke my wookie...." diff --git a/sql-edition/servers/VendServer.py b/sql-edition/servers/VendServer.py index d6f48c9..93f22f2 100755 --- a/sql-edition/servers/VendServer.py +++ b/sql-edition/servers/VendServer.py @@ -205,7 +205,8 @@ def setup_idlers(v): GrayIdler(v,one="/",zero="\\",reorder=1), StringIdler(v, text=str(math.e) + " "), GrayIdler(v,one="X",zero="O",reorder=1), - StringIdler(v, text="I want some pizza - please call Pizza Hut Shenton Park on +61 8 9381 9979 - and order as Quinn - I am getting really hungry", repeat=False), + StringIdler(v, text=" I want some pizza - please call Pizza Hut Shenton Park on +61 8 9381 9979 - and order as Quinn - I am getting really hungry", repeat=False), + PipeIdler(v, "/usr/bin/ypcat", "passwd"), FortuneIdler(v), ClockIdler(v), StringIdler(v),