| 1 | #!/bin/sh |
| 2 | |
| 3 | usage() |
| 4 | { |
| 5 | exec 1>&2 |
| 6 | echo "usage: ${0##*/} program [args ...]" |
| 7 | echo " to prevent the laptop from sleeping while 'program' is running" |
| 8 | exit 1 |
| 9 | } |
| 10 | |
| 11 | case $1 in |
| 12 | -*|"") usage ;; |
| 13 | esac |
| 14 | |
| 15 | # powerd will clean this up after we're gone. and if the touch |
| 16 | # doesn't work, it's probably because powerd's not running and the |
| 17 | # directory isn't there /var/run. |
| 18 | touch /var/run/powerd-inhibit-suspend/$$ 2>/dev/null |
| 19 | |
| 20 | exec "$@" |
| 21 |