Skip to content

Instantly share code, notes, and snippets.

@duvrai
Last active August 29, 2015 14:12
Show Gist options
  • Save duvrai/6c04887a4ba6cd9e6e3c to your computer and use it in GitHub Desktop.
Save duvrai/6c04887a4ba6cd9e6e3c to your computer and use it in GitHub Desktop.
Writes a random byte every minute to a .nosleep file
#!/bin/bash
if [ "$1" ]
then
while true
do
date
for param in "$@"
do
echo Writing "$param/.nosleep"
head -c1 /dev/random >"$param/.nosleep"
done
sleep 60
done
else
echo "Writes a random byte every minute to a .nosleep file"
echo "Usage:"
echo " nosleep directory [directory ...]"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment