Last active
January 25, 2016 20:59
-
-
Save blaise-io/6c2349deaccd1950b161 to your computer and use it in GitHub Desktop.
Debug cron job in minimal environment
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
# 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