Unable to set a cron job to take backup of the postgresql database

允我心安 提交于 2019-12-11 15:39:16

问题


I have tried to backup postgresql database by using many methods but unable to do.Please help me.

/etc/crontab

0 6 * * * sudo pg_dump -U USERNAME -h REMOTE_HOST -p REMOTE_PORT NAME_OF_DB > LOCATION_AND_NAME_OF_BACKUP_FILE

.pgpass

localhost:5432:db_name:postgres:password

/etc/crontab

 0 6 * * *  /home/backup.php

backup.php

 <?php
    exec('pg_dump --dbname=postgresql://username:password@127.0.0.1:5432/mydatabase > dbbackup.sql',$output);
    print_r($output);
?>

I tried this as well. https://dzone.com/articles/linux-database-backup-scheduler-script-postgresql

来源:https://stackoverflow.com/questions/56890449/unable-to-set-a-cron-job-to-take-backup-of-the-postgresql-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!