diff options
author | Bill <bill@billserver.senders.io> | 2021-04-24 16:52:19 -0400 |
---|---|---|
committer | Bill <bill@billserver.senders.io> | 2021-04-24 16:52:19 -0400 |
commit | ac7d768544df612997ebdef8b40d56ab0d468f25 (patch) | |
tree | 9c1dc5265fdf27ba2f248b92c974dd8816f65a3c | |
parent | ddeab6ea9666ba0fee35fdd09724b7a663943f1a (diff) |
Bug Fixes: Wrong lastrun and fetch lookup
Typos in the fetch file variable and not using the last run file
variable.
-rwxr-xr-x | ssync | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -23,15 +23,16 @@ SSYNC_DIR=$HOME/.local/ssync FETCHED_FILE=$SSYNC_DIR/fetched FETCH_FILE=$SSYNC_DIR/fetch LASTRAN_FILE=$SSYNC_DIR/lastran -NEXT_RUN_DATE=$(date -Is) -CURGET_FILE=$SSYNC_DIR/.$RUNID +NEXT_RUN_DATE=$(date -u -Is -d '5 minutes ago') +RUN_DIR=$SSYNC_DIR/.runs/ +CURGET_FILE=$RUN_DIR/$RUNID if [ ! -f $LASTRAN_FILE ]; then mkdir -p $SSYNC_DIR echo $NEXT_RUN_DATE > $LASTRAN_FILE log "No run existed marking next run for files newer than: $NEXT_RUN_DATE" exit 0; fi -PREV_RUN_DATE=$(cat $HOME/.local/ssync/.lastran) +PREV_RUN_DATE=$(cat $LASTRAN_FILE) # main @@ -51,9 +52,10 @@ log "Syncing files since: $PREV_RUN_DATE" log "Fetching files" +mkdir -p $RUN_DIR ssh -i $KEY_FILE $REMOTE "find ${REMOTE_DIR} -newermt ${PREV_RUN_DATE} -exec realpath --relative-to ${REMOTE_DIR} {} \;" >> $CURGET_FILE comm -23 <(sort -u $CURGET_FILE) <(sort -u $FETCHED_FILE) > $FETCH_FILE -COUNT=$(wc -l $FETCHED_FILE | cut -d' ' -f1) +COUNT=$(wc -l $FETCH_FILE | cut -d' ' -f1) if [ $COUNT -gt 0 ]; then # |