Skip to content

Instantly share code, notes, and snippets.

@blaise-io
Last active January 25, 2016 20:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blaise-io/6c2349deaccd1950b161 to your computer and use it in GitHub Desktop.
Save blaise-io/6c2349deaccd1950b161 to your computer and use it in GitHub Desktop.
Debug cron job in minimal environment
# Sometimes cron jobs don't execute properly. It's hard to debug because
# the job may execute just fine if you run it manually in your shell.
# That's because cron jobs run in a minimal shell by default.
# This will run the script in a minimal environment:
env - /path/to/script.sh
# Spoiler alert: Usually, the solution is to define the shell in the script,
# by prepending #!/bin/bash.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment