diff options
author | haturau <135221985+haturatu@users.noreply.github.com> | 2024-08-22 10:35:19 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-22 10:35:19 +0900 |
commit | 8df7932ed43899a91fcbf6ec67da372d1cf31f19 (patch) | |
tree | d0fd60ecfa352c243efc7c34c0e71c0c7b1229c8 | |
parent | a10911c789363f3d38884ff2fc43a22e4c178ba9 (diff) |
Update lume-watcher
-rw-r--r-- | lume-watcher | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lume-watcher b/lume-watcher index e1d9b8d..c5ce5c5 100644 --- a/lume-watcher +++ b/lume-watcher @@ -11,6 +11,7 @@ WATCHED_DIR="/var/www/html/soulmining/src/" COMMAND="/home/haturatu/.deno/bin/deno task lume --dest=site" +OUTPUT_ROOT_DIR="/var/www/html/soulmining" COOLDOWN_TIME=60 LAST_RUN_FILE="/tmp/last_run.time" LOG_FILE="/var/log/lume-watcher.log" @@ -43,7 +44,7 @@ set_last_run_time() { current_time > "$LAST_RUN_FILE" } -# デーモンの開始 +# 監視開始を行う monitor_directory() { inotifywait -m -r -e modify,create,delete "$WATCHED_DIR" | while read -r directory events filename; do echo "$(date): Change detected" >> "$LOG_FILE" @@ -52,7 +53,7 @@ monitor_directory() { if [ $((now - last_run_time)) -ge $COOLDOWN_TIME ]; then echo "$(date): Executing command" >> "$LOG_FILE" - cd /var/www/html/soulmining || exit + cd $OUTPUT_ROOT_DIR || exit $COMMAND >> "$LOG_FILE" 2>&1 cd ~ || exit set_last_run_time @@ -62,6 +63,7 @@ monitor_directory() { done } +# デーモンの開始 start() { echo "Starting lume-watcher..." monitor_directory & |