Skip to content

Commit a40c276

Browse files
authored
Merge pull request #2097 from elitvinov/gitlab-backup-logging
Add logging for backup operations
2 parents c3f0b37 + 755e3f7 commit a40c276

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
@@ -784,19 +784,20 @@ gitlab_configure_backups_schedule() {
784784
daily|weekly|monthly)
785785
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
786786
echo "Configuring gitlab::backups::schedule..."
787-
read hour min <<< ${GITLAB_BACKUP_TIME//[:]/ }
788-
day_of_month=*
789-
month=*
790-
day_of_week=*
787+
gitlab_backup_log="${GITLAB_LOG_DIR}/gitlab/gitlab-backup.log"
788+
read -r hour min <<< "${GITLAB_BACKUP_TIME//[:]/ }"
789+
day_of_month="*"
790+
month="*"
791+
day_of_week="*"
791792
case ${GITLAB_BACKUP_SCHEDULE} in
792793
daily) ;;
793794
weekly) day_of_week=0 ;;
794795
monthly) day_of_month=01 ;;
795796
esac
796797
if [[ -n ${GITLAB_BACKUP_DIR_GROUP} ]]; then
797-
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}
798+
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}"
798799
else
799-
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}
800+
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}"
800801
fi
801802
crontab -u ${GITLAB_USER} /tmp/cron.${GITLAB_USER}
802803
fi

0 commit comments

Comments
 (0)