How to Keep Your ServiceNow PDI From Flatlining

Remember the heartbreak of losing a Personal Developer Instance (PDI) because you forgot to log in for a few days? Yeah, me too. It’s like ServiceNow saying, “you had one job.”

So I built this: a tiny Bash script and a scoped app to keep your PDI Stayin’ Alive -Travolta style.

Here’s the disco-ball recipe:

  1. A Scoped App in ServiceNow that logs “heartbeat” pings.
  2. A cron-powered Bash script on your machine that does the actual pinging.

The result: your PDI never times out, and you get a log in ServiceNow proving you’re still alive and grooving.


Quick Start (a.k.a. The Dance Moves)

1. Fork This Repo

Click Fork up top and make it yours. Then pull it down locally:

git clone https://github.com/YOUR-USERNAME/StayinAlivePDI.git
cd StayinAlivePDI

2. Create a GitHub PAT (Your Disco Pass)

If you haven’t done this before:

  1. Go to GitHub → Settings → Developer Settings → Personal Access Tokens.
  2. Generate a new token.
  3. Give it a name like StayinAlivePDI (or SaturdayNightFever if you’re feeling spicy).
  4. Expiration: 90 days is plenty.
  5. Scope: check repo.
  6. Copy that token like your life depends on it. You’ll need it.

3. Install the App in Your PDI

  1. In your PDI, go to Connections & Credentials → Credentials.
  2. Click NewBasic Auth Credentials.
    • Name: GitHub
    • Username: your GitHub username
    • Password: your shiny new PAT
  3. Now head to System Applications → Studio → Import From Source Control.
    • URL: your fork’s repo URL
    • Credential: the GitHub one you just made
  4. Import the app.

Congratulations. You now have:

  • A Keepalive Log table to track heartbeats

4. Local Setup (Your Boombox)

Copy the creds template:

cp credentials.sh.example credentials.sh

Fill it in:

#!/bin/bash
SNow_URL="https://devXXXXX.service-now.com"   # no trailing slash
SNow_USER="admin"
SNow_PASS='your_password'

Lock it down:

chmod 600 credentials.sh

5. Test the Script

Make it executable:

chmod +x keep_pdi_alive.sh

Run it:

./keep_pdi_alive.sh

Expected result:

2025-09-26 09:15:01 - Keep-alive POST returned HTTP 201

Now check your PDI → Stayin’ Alive → Keepalive Logs. Boom, proof you’re alive.


6. Automate with Cron (Autoplay the Record)

Pop open your crontab:

crontab -e

Add this:

0 9 * * * cd /Users/YOURNAME/Path/StayinAlivePDI && ./keep_pdi_alive.sh >> pdi_keepalive.log 2>&1
  • Runs every morning at 9am.
  • Appends logs to pdi_keepalive.log.

Check the groove:

tail -f pdi_keepalive.log

Mac Users: Give Cron PERMISSION

macOS likes to play security cop. Without permissions, you’ll see:

Operation not permitted

Fix it:

  1. System Settings → Privacy & Security → Full Disk Access
  2. Unlock with your password
  3. Add /usr/sbin/cron
  4. Toggle it ON
  5. Restart cron or reboot

Now cron can boogie in your Documents/ folder.


Verification (Proof You’re Dancing)

  • Local: pdi_keepalive.log should have daily entries
  • In PDI: your Keepalive Log table fills with each ping
  • System Logs → Transactions also show /stayin_alive/ping

Security (Don’t Spill Your Drink)

  • Never commit credentials.sh (already in .gitignore)
  • Wrap your password in 'single quotes' if it has $ or !
  • If you nuke and rebuild your PDI, just update SNow_URL

Example Output (Encore!)

Local log:

2025-09-26 09:00:00 - Keep-alive POST returned HTTP 201

Keepalive Log in ServiceNow:

Run Time Status Message Source
2025-09-26 09:00:00 200 cron ping MyMac

Final Bow

  • Fork → PAT → Credential → Import App
  • Fill in creds → Run script → Add cron
  • Verify logs → Dance forever

Stayin’ Alive: your PDI heartbeat that never skips a beat.

UPDATE: Not sure this actually works anymore…