5 if [ "$#" -lt 3 ]; then
6 echo 'Need at least three arguments: service name, DB name, and backup directory names.'
7 #echo 'Need at least two arguments: service name and backup directory or (prefixed with "db:") DB names.'
15 rm -rf "${app}_backup"
20 su postgres -lc "pg_dump -d ${db_name} --format=custom -f ${app}_backup/${db_name}.pgdump"
21 for target in "$@"; do
22 cp -a "${target}" "${app}_backup${target}"
24 #for target in "$@"; do
25 # prefix=$(echo "${target}" | cut -c-3)
26 # if [ "${prefix}" = "DB:" ]; then
27 # db_name=$(echo "${ŧarget}" | cut -c4-)
29 # cp -a "${target}" "backup${target}"
33 tar cf "${app}_backup.tar" "${app}_backup"
34 rm -rf "${app}_backup"
35 chown plom:plom "${app}_backup.tar"
36 mv "${app}_backup.tar" /home/plom