#!/bin/sh
time=$(date '+%Y-%m-%d')
cd /usr/pgsql-10/bin
PGPASSWORD=******* ./pg_dumpall -U postgres > /usr/pgdb/${time}.pgdb.out
count=`ls /usr/pgdb/ | wc -w`
if [ ${count} -gt 3 ]
then
rm -f `ls -t /usr/pgdb | tail -n -1`
fi
~
#!/bin/sh
time=$(date '+%Y-%m-%d')
cd /usr/pgsql-10/bin
PGPASSWORD=******* ./pg_dumpall -U postgres > /usr/pgdb/${time}.pgdb.out
count=`ls /usr/pgdb/ | wc -w`
if [ ${count} -gt 3 ]
then
rm -f `ls -t /usr/pgdb | tail -n -1`
fi
~