-
-
Save nancystodd/a15520ea611d403ef2b12098a24723ea to your computer and use it in GitHub Desktop.
keeps a ServiceNow developer instance awake, at least until the nightly snooze-all
This file contains 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 | |
# put your instance id here | |
instance="dev######" | |
# make sure your password doesn't have shell operators in it | |
credentials="admin:password" | |
while true; do | |
entropy==$RANDOM | |
outdata="{\"short_description\":\"Automated incident $entropy\"}" | |
curl --user $credentials \ | |
--header "Content-Type: application/json" \ | |
--header "Accept: application/json" \ | |
--request POST \ | |
--data "$outdata" \ | |
"https://$instance.service-now.com/api/now/table/incident" | |
echo "\n\n" | |
# Change the 1200 to the max number of time you need for the timer | |
# This is using seconds but if you need minutes, change the s to m | |
sleeptime=$(($RANDOM % 1200))s | |
echo "created incident, waiting $sleeptime" | |
sleep $sleeptime | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I was getting an error using rand so I changed it to use $RANDOM and now it works.