daojeil commited on
Commit
0b69ef5
·
verified ·
1 Parent(s): 26e75ca

Update cron-job.sh

Browse files
Files changed (1) hide show
  1. cron-job.sh +12 -9
cron-job.sh CHANGED
@@ -12,12 +12,15 @@ echo "$(date): Starting cron job" >> $LOG_FILE
12
  echo "$(date): Pulling latest changes from repository" >> $LOG_FILE
13
  git -C $TARGET_DIR pull $REPO_URL >> $LOG_FILE 2>&1
14
 
15
- # Check if there are changes to commit
16
- if [[ -n $(git -C $TARGET_DIR status -s) ]]; then
17
- echo "$(date): Changes detected, committing changes" >> $LOG_FILE
18
- git -C $TARGET_DIR add . >> $LOG_FILE 2>&1
19
- git -C $TARGET_DIR commit -m "Automated commit of changes" >> $LOG_FILE 2>&1
20
- git -C $TARGET_DIR push $REPO_URL >> $LOG_FILE 2>&1
21
- else
22
- echo "$(date): No changes detected" >> $LOG_FILE
23
- fi
 
 
 
 
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
16
+ # Check if there are changes to commit
17
+ if [[ -n $(git -C $TARGET_DIR status -s) ]]; then
18
+ echo "$(date): Changes detected, committing changes" >> $LOG_FILE
19
+ git -C $TARGET_DIR add . >> $LOG_FILE 2>&1
20
+ git -C $TARGET_DIR commit -m "Automated commit of changes" >> $LOG_FILE 2>&1
21
+ git -C $TARGET_DIR push $REPO_URL >> $LOG_FILE 2>&1
22
+ else
23
+ echo "$(date): No changes detected" >> $LOG_FILE
24
+ fi
25
+ sleep 60
26
+ done