#!/bin/bash

set -e

if test "$1" != start -a "$1" != stop; then
    die "Usage: $(basename $0) [start|stop]"
fi

if test "$1" = start -o "$1" = on; then
    touch /data/do-vibrator
    while test -e /data/do-vibrator; do
	echo 1000 > /sys/class/timed_output/vibrator/enable
	sleep 1;
    done >/dev/null 2>&1 &
else
    rm /data/do-vibrator || true
fi
