Maybe you're having the same problem that yuryfdr had with his midi music player: the device just goes to sleep if there aren't any UI events in some short amount of time. The way around this was to bracket his script with the lines:
Code:
echo test > /sys/power/wake_lock
<script code goes here>
echo test > /sys/power/wake_unlock
I suspect that it would be better to set up an exit "trap" for the last line to ensure that it always gets called, no matter how the script ends:
Code:
trap 'echo test > /sys/power/wake_unlock' EXIT
Otherwise, battery usage will go up if the device can't sleep during inactivity.