Skip to content

Instantly share code, notes, and snippets.

@januszm
Created March 1, 2021 12:55
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 januszm/72fa4e5bb23dae9788473a991d30c121 to your computer and use it in GitHub Desktop.
Save januszm/72fa4e5bb23dae9788473a991d30c121 to your computer and use it in GitHub Desktop.
Run command as cron
# env - run a program in a modified environment
# envirotnment is read from crontab file, usually it's below and nothing else:
# SHELL=/bin/sh
# PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
env - `cat /etc/crontab | grep -v "#" | grep -v "^$" | grep -v /etc/cron` my_script.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment