daojeil commited on
Commit
778d4c9
·
verified ·
1 Parent(s): fee6b23

Update cron-job.sh

Browse files
Files changed (1) hide show
  1. cron-job.sh +6 -2
cron-job.sh CHANGED
@@ -1,8 +1,8 @@
1
- #!/bin/bash
2
 
3
  # Git configuration
4
  REPO_URL="https://${GITHUB_USERNAME}:${GITHUB_TOKEN}@github.com/${GIT_REPO}"
5
- TARGET_DIR="/app/backend/data/webui.db"
6
  LOG_FILE="/var/log/cron.log"
7
 
8
  # Log start time
@@ -10,6 +10,10 @@ echo "$(date): Starting cron job" >> $LOG_FILE
10
 
11
  # Pull the latest changes from the repository
12
  echo "$(date): Pulling latest changes from repository" >> $LOG_FILE
 
 
 
 
13
  git -C $TARGET_DIR pull $REPO_URL >> $LOG_FILE 2>&1
14
 
15
  while true; do
 
1
+ #!/usr/bin/env bash
2
 
3
  # Git configuration
4
  REPO_URL="https://${GITHUB_USERNAME}:${GITHUB_TOKEN}@github.com/${GIT_REPO}"
5
+ TARGET_DIR="/app/backend/data"
6
  LOG_FILE="/var/log/cron.log"
7
 
8
  # Log start time
 
10
 
11
  # Pull the latest changes from the repository
12
  echo "$(date): Pulling latest changes from repository" >> $LOG_FILE
13
+ cd $TARGET_DIR
14
+ git config --global --add safe.directory $TARGET_DIR >> $LOG_FILE 2>&1
15
+ git init >> $LOG_FILE 2>&1
16
+ git remote add origin $REPO_URL >> $LOG_FILE 2>&1
17
  git -C $TARGET_DIR pull $REPO_URL >> $LOG_FILE 2>&1
18
 
19
  while true; do