Check for updates, log more info.
This commit is contained in:
@@ -29,10 +29,6 @@ create_lock() {
|
|||||||
touch "$LOCK_FILE"
|
touch "$LOCK_FILE"
|
||||||
}
|
}
|
||||||
|
|
||||||
remove_lock() {
|
|
||||||
rm -f "$LOCK_FILE"
|
|
||||||
}
|
|
||||||
|
|
||||||
run_after() {
|
run_after() {
|
||||||
local after_pull_script=$1
|
local after_pull_script=$1
|
||||||
source $after_pull_script
|
source $after_pull_script
|
||||||
@@ -59,6 +55,7 @@ check_for_updates() {
|
|||||||
local current_commit_hash
|
local current_commit_hash
|
||||||
|
|
||||||
# Get the last known commit hash (from a file)
|
# Get the last known commit hash (from a file)
|
||||||
|
echo "$REPO_LOCAL_PATH/$REPO_NAME"
|
||||||
cd "$REPO_LOCAL_PATH/$REPO_NAME"
|
cd "$REPO_LOCAL_PATH/$REPO_NAME"
|
||||||
if [ -f "$REPO_LOCAL_PATH/$repo_name/.git-monitor-last-commit" ]; then
|
if [ -f "$REPO_LOCAL_PATH/$repo_name/.git-monitor-last-commit" ]; then
|
||||||
last_commit_hash=$(cat "$REPO_LOCAL_PATH/$repo_name/.git-monitor-last-commit")
|
last_commit_hash=$(cat "$REPO_LOCAL_PATH/$repo_name/.git-monitor-last-commit")
|
||||||
@@ -85,7 +82,7 @@ check_for_updates() {
|
|||||||
|
|
||||||
# Main Execution
|
# Main Execution
|
||||||
|
|
||||||
trap 'remove_lock' EXIT
|
trap 'rm -f $LOCKFILE' EXIT
|
||||||
|
|
||||||
check_lock
|
check_lock
|
||||||
create_lock
|
create_lock
|
||||||
@@ -104,4 +101,3 @@ while true; do
|
|||||||
sleep "$POLL_INTERVAL"
|
sleep "$POLL_INTERVAL"
|
||||||
done
|
done
|
||||||
|
|
||||||
remove_lock # This won't be reached in this infinite loop. Useful if exiting gracefully.
|
|
||||||
|
|||||||
Reference in New Issue
Block a user