Created
February 18, 2016 05:51
-
-
Save atruskie/20c1916d8f6dfbc6419a to your computer and use it in GitHub Desktop.
Simulate a long running script without the annoyance of setting up dependencies
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ANALYSIS_LENGTH=$(shuf -i 10-1000 -n 1) | |
echo -e "`date -u`: Analysis will take $ANALYSIS_LENGTH seconds" | |
sleep $ANALYSIS_LENGTH | |
echo "`date -u`: timeout completed" | |
ANALYSIS_SUCCESS=$[$RANDOM % 2] | |
echo -e "`date -u`: Analysis exit code: $ANALYSIS_SUCCESS" | |
exit $ANALYSIS_SUCCESS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment