1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
#!/bin/bash
# This script was written by Daniele Favara <danjele@gmail.com>
# Stripped for keytouch by Rodrigo Gallardo <rodrigo@nul-unu.com>
set -e
while [ ! -z "$1" ];do
case "$1" in
--help|-h)
echo "Usage: keytouchd-launch [command]"
echo "Launch the keytouch daemons in background, before running COMMAND."
echo "Please see 'man keytouchd-launch' for details."
exit
;;
*)
SESSION=$@ ; shift $#
;;
esac
done
if [ "x$SESSION" = "x" ]; then
# No session? We die
echo "You must provide a command to run."
exit 1
else
keytouchd & keytouchdpid=$!
# Run the session, kill the daemons afterwards
$SESSION
while ps $keytouchdpid
do
kill $keytouchdpid || sleep 5
done
exit $?
fi
|