Skip to content

Instantly share code, notes, and snippets.

@YouSysAdmin
Created August 26, 2019 14:26
Show Gist options
  • Save YouSysAdmin/ce40dc255c62e290e0ae78c0a5badcab to your computer and use it in GitHub Desktop.
Save YouSysAdmin/ce40dc255c62e290e0ae78c0a5badcab to your computer and use it in GitHub Desktop.
execute SQL query from cron
# .cron_env
# Save to /root directory, chmod 400/600
export DB_HOST="127.0.0.1"
export DB_USER="postgres"
export DB_PASSWORD="postgres"
# cron
59 23 * * * . /root/.cron_env; /usr/bin/psql_super_puper.sh $DB_USER $DB_PASSWORD $DB_HOST "select * from ololo"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment