Skip to content

Commit 755e3f7

Browse files
author
Evgeny Litvinov
committed
Add logging for backup operations to file ${GITLAB_LOG_DIR}/gitlab/gitlab-backup.log
1 parent 2ea27ee commit 755e3f7

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

assets/runtime/functions

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -769,19 +769,20 @@ gitlab_configure_backups_schedule() {
769769
daily|weekly|monthly)
770770
if ! crontab -u ${GITLAB_USER} -l >/tmp/cron.${GITLAB_USER} 2>/dev/null || ! grep -q 'bundle exec rake gitlab:backup:create' /tmp/cron.${GITLAB_USER}; then
771771
echo "Configuring gitlab::backups::schedule..."
772-
read hour min <<< ${GITLAB_BACKUP_TIME//[:]/ }
773-
day_of_month=*
774-
month=*
775-
day_of_week=*
772+
gitlab_backup_log="${GITLAB_LOG_DIR}/gitlab/gitlab-backup.log"
773+
read -r hour min <<< "${GITLAB_BACKUP_TIME//[:]/ }"
774+
day_of_month="*"
775+
month="*"
776+
day_of_week="*"
776777
case ${GITLAB_BACKUP_SCHEDULE} in
777778
daily) ;;
778779
weekly) day_of_week=0 ;;
779780
monthly) day_of_month=01 ;;
780781
esac
781782
if [[ -n ${GITLAB_BACKUP_DIR_GROUP} ]]; then
782-
echo "$min $hour $day_of_month $month $day_of_week /bin/bash -l -c 'cd ${GITLAB_INSTALL_DIR} && bundle exec rake gitlab:backup:create SKIP=${GITLAB_BACKUP_SKIP} DIRECTORY=${GITLAB_BACKUP_DIR_GROUP} RAILS_ENV=${RAILS_ENV}'" >> /tmp/cron.${GITLAB_USER}
783+
echo "$min $hour $day_of_month $month $day_of_week /bin/bash -l -c 'cd ${GITLAB_INSTALL_DIR} && bundle exec rake gitlab:backup:create SKIP=${GITLAB_BACKUP_SKIP} DIRECTORY=${GITLAB_BACKUP_DIR_GROUP} RAILS_ENV=${RAILS_ENV}' >> ${gitlab_backup_log} 2>&1" >> "/tmp/cron.${GITLAB_USER}"
783784
else
784-
echo "$min $hour $day_of_month $month $day_of_week /bin/bash -l -c 'cd ${GITLAB_INSTALL_DIR} && bundle exec rake gitlab:backup:create SKIP=${GITLAB_BACKUP_SKIP} RAILS_ENV=${RAILS_ENV}'" >> /tmp/cron.${GITLAB_USER}
785+
echo "$min $hour $day_of_month $month $day_of_week /bin/bash -l -c 'cd ${GITLAB_INSTALL_DIR} && bundle exec rake gitlab:backup:create SKIP=${GITLAB_BACKUP_SKIP} RAILS_ENV=${RAILS_ENV}' >> ${gitlab_backup_log} 2>&1" >> "/tmp/cron.${GITLAB_USER}"
785786
fi
786787
crontab -u ${GITLAB_USER} /tmp/cron.${GITLAB_USER}
787788
fi

0 commit comments

Comments
 (0)