systemcr Posted January 6, 2020 Posted January 6, 2020 Hello, I'd like to know if I can use 'psql' instead of 'php' to run a daily maintenance SQL script on my PostgreSQL database as a cron job from cPanel. The command line to execute would be something similar to the following, according to https://dba.stackexchange.com/questions/157991/how-to-create-jobs-in-postgresql/157992#157992 psql -d myDb -f "maintenance.sql" Thank you very much in advance. Quote
wolstech Posted January 6, 2020 Posted January 6, 2020 I don't see why not, but I'm not sure whether the cron will have the access necessary to connect to your databases when it runs. The cron should run as your user account. If you need to provide other credentials, read up on the .pgpass file. You can create it and put it in your home folder to provide credentials for psql to use. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.