Skip to content

Instantly share code, notes, and snippets.

@spion
Created November 19, 2015 17:00
Show Gist options
  • Save spion/aa97f29b76b712ac4698 to your computer and use it in GitHub Desktop.
Save spion/aa97f29b76b712ac4698 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Usage: ./timeout-alert.sh <time> "alert commands to execute" "main command to execute"
(sleep $1 && eval $2 ) &
ALERTPID=$!
eval $3
kill $ALERTPID > /dev/null 2>&1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment