# Client backup script (cron job) - backup of the UROSOFT database # Collected: 2026-11-19T00:03Z (UTC) # Source path: /home/BackupPostgres.sh on the database server (user soporteputumayo) # The script has no inline password: pg_dump connects as role admin and takes the # credentials from the account's PGPASS file (not reproduced here). # Relevant defect: the file is not executable and cron calls it directly, so every # run fails with "Permission denied" before any dump is written. === cat /home/BackupPostgres.sh === #!/bin/bash # # Backup a Postgresql database into a daily file. # BACKUP_DIR=/respaldos/BkDB_Urosoft DAYS_TO_KEEP=30 FILE_SUFFIX=_pg_backup.sql DATABASE=UROSOFT USER=admin HOST=127.0.0.1 FILE=`date +"%Y%m%d%H%M"`${FILE_SUFFIX} OUTPUT_FILE=${BACKUP_DIR}/${FILE} # do the database backup (dump) # use this command for a database server on localhost. add other options if need be. pg_dump -U ${USER} -h ${HOST} ${DATABASE} -F p -f ${OUTPUT_FILE} # gzip the mysql database dump file gzip $OUTPUT_FILE # show the user the result echo "${OUTPUT_FILE}.gz was created:" ls -l ${OUTPUT_FILE}.gz # prune old backups find $BACKUP_DIR -maxdepth 1 -mtime +$DAYS_TO_KEEP -name "*${FILE_SUFFIX}.gz" -exec rm -rf '{}' ';' === ls -l /home/BackupPostgres.sh === -rw-rw-r-- 1 soporteputumayo soporteputumayo 713 Sep 13 2023 /home/BackupPostgres.sh