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