Skip to content

Instantly share code, notes, and snippets.

@jsmayo
Forked from assertivist/snkeepalive.sh
Created January 25, 2020 05:37
Show Gist options
  • Save jsmayo/85737dd02eed199c4adb82437e0e2dab to your computer and use it in GitHub Desktop.
Save jsmayo/85737dd02eed199c4adb82437e0e2dab to your computer and use it in GitHub Desktop.
keeps a ServiceNow developer instance awake, at least until the nightly snooze-all
#!/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=`rand`
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"
sleeptime="`rand -M 5`m"
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