HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux vmi1674223.contaboserver.net 5.4.0-182-generic #202-Ubuntu SMP Fri Apr 26 12:29:36 UTC 2024 x86_64
User: root (0)
PHP: 7.4.3-4ubuntu2.22
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //opt/openproject/packaging/scripts/backup
#!/bin/bash

set -e

TARGET="/var/db/${APP_NAME}/backup"

mkdir -p "${TARGET}"

timestamp=$(date +"%Y%m%d%H%M%S")

echo -n "* Generating database backup..." >&2
dst="${TARGET}/postgresql-dump-${timestamp}.pgdump"
touch "$dst" && chmod 0640 "$dst"
pg_dump -Fc $DATABASE_URL > $dst

echo " done" >&2
echo "$dst"

if [ -d "$SVN_REPOSITORIES" ]; then
  dst="${TARGET}/svn-repositories-${timestamp}.tar.gz"
  touch "$dst" && chmod 0640 "$dst"
  echo -n "* Generating SVN repositories backup..." >&2
  if tar czf "$dst" -C "${SVN_REPOSITORIES}" . ; then
    echo " done" >&2
    echo "$dst"
  else
    echo " failed" >&2
  fi
else
  echo "* No SVN repositories folder. Ignoring." >&2
fi

if [ -d "$GIT_REPOSITORIES" ]; then
  dst="${TARGET}/git-repositories-${timestamp}.tar.gz"
  touch "$dst" && chmod 0640 "$dst"
  echo -n "* Generating Git repositories backup..." >&2
  if tar czf "$dst" -C "${GIT_REPOSITORIES}" . ; then
    echo " done" >&2
    echo "$dst"
  else
    echo " failed" >&2
  fi
else
  echo "* No Git repositories folder. Ignoring." >&2
fi

if [ -d "$ATTACHMENTS_STORAGE_PATH" ]; then
  dst="${TARGET}/attachments-${timestamp}.tar.gz"
  touch "$dst" && chmod 0640 "$dst"
  echo -n "* Generating attachments backup..." >&2
  if tar czf "$dst" -C "${ATTACHMENTS_STORAGE_PATH}" . ; then
    echo " done" >&2
    echo "$dst"
  else
    echo " failed" >&2
  fi
else
  echo "* No attachments folder. Ignoring." >&2
fi

if [ -d "/etc/${APP_NAME}/conf.d" ]; then
  dst="${TARGET}/conf-${timestamp}.tar.gz"
  touch "$dst" && chmod 0640 "$dst"
  echo -n "* Saving configuration..." >&2
  if tar czf "$dst" -C /etc/${APP_NAME}/conf.d . ; then
    echo " done" >&2
    echo "$dst"
  else
    echo " failed" >&2
  fi
else
  echo "* no configuration folder. Ignoring." >&2
fi