Beep on completion
This commit is contained in:
43
client/alert.py
Executable file
43
client/alert.py
Executable file
@@ -0,0 +1,43 @@
|
|||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
|
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser(description='iconograph wait_for_service')
|
||||||
|
parser.add_argument(
|
||||||
|
'--type',
|
||||||
|
dest='type',
|
||||||
|
action='store',
|
||||||
|
choices={'happy', 'angry'},
|
||||||
|
required=True)
|
||||||
|
FLAGS = parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
|
def Happy():
|
||||||
|
yield '\a'
|
||||||
|
time.sleep(3.0)
|
||||||
|
|
||||||
|
|
||||||
|
def Angry():
|
||||||
|
yield '\a'
|
||||||
|
time.sleep(0.2)
|
||||||
|
|
||||||
|
|
||||||
|
_TYPES = {
|
||||||
|
'happy': Happy,
|
||||||
|
'angry': Angry,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
handler = _TYPES[FLAGS.type]
|
||||||
|
while True:
|
||||||
|
for item in handler():
|
||||||
|
sys.stdout.write(item)
|
||||||
|
sys.stdout.flush()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
@@ -86,6 +86,8 @@ script
|
|||||||
echo "==================" >/dev/tty7
|
echo "==================" >/dev/tty7
|
||||||
echo "autoimage complete" >/dev/tty7
|
echo "autoimage complete" >/dev/tty7
|
||||||
echo "==================" >/dev/tty7
|
echo "==================" >/dev/tty7
|
||||||
|
|
||||||
|
/autoimage/client/alert.py --type=happy </dev/tty7 >/dev/tty7
|
||||||
end script
|
end script
|
||||||
""" % {
|
""" % {
|
||||||
'host': parsed.hostname,
|
'host': parsed.hostname,
|
||||||
|
|||||||
Reference in New Issue
Block a user