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"
19 su postgres -lc "pg_dump -d ${db_name} --format=custom -f ${app}_backup/${db_name}.pgdump"
20 for target in "$@"; do
21 cp -a "${target}" "${app}_backup${target}"
23 #for target in "$@"; do
24 # prefix=$(echo "${target}" | cut -c-3)
25 # if [ "${prefix}" = "DB:" ]; then
26 # db_name=$(echo "${ŧarget}" | cut -c4-)
28 # cp -a "${target}" "backup${target}"
32 tar cf "${app}_backup.tar" "${app}_backup"
33 rm -rf "${app}_backup"
34 chown plom:plom "${app}_backup.tar"
35 mv "${app}_backup.tar" /home/plom