File: olpc-nosleep

package info (click to toggle)
olpc-powerd 23-2
  • links: PTS
  • area: main
  • in suites: bullseye, buster, jessie, jessie-kfreebsd, squeeze, stretch, wheezy
  • size: 908 kB
  • ctags: 229
  • sloc: sh: 2,679; ansic: 887; makefile: 69
file content (21 lines) | stat: -rwxr-xr-x 439 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh

usage()
{
    exec 1>&2
    echo "usage: ${0##*/} program [args ...]"
    echo "  to prevent the laptop from sleeping while 'program' is running"
    exit 1
}

case $1 in
    -*|"")  usage ;;
esac

# powerd will clean this up after we're gone.  and if the touch
# doesn't work, it's probably because powerd's not running and the
# directory isn't there /var/run.
touch /var/run/powerd-inhibit-suspend/$$ 2>/dev/null

exec "$@"