diff options
-rw-r--r-- | README.md | 8 | ||||
-rw-r--r-- | lume-watcher | 5 |
2 files changed, 8 insertions, 5 deletions
@@ -25,14 +25,14 @@ done! ## Start-Stop ``` -sudo /etc/init.d/lume-watcher start +sudo service lume-watcher start ``` ``` -sudo /etc/init.d/lume-watcher stop +sudo service lume-watcher stop ``` ``` -sudo /etc/init.d/lume-watcher restart +sudo service lume-watcher restart ``` ``` -sudo /etc/init.d/lume-watcher status +sudo service lume-watcher status ``` diff --git a/lume-watcher b/lume-watcher index 3d299c0..70f1d58 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" @@ -55,6 +56,7 @@ monitor_directory() { sleep 10 cd /var/www/html/soulmining || exit + cd $OUTPUT_ROOT_DIR || exit $COMMAND >> "$LOG_FILE" 2>&1 cd ~ || exit @@ -65,6 +67,7 @@ monitor_directory() { done } +# デーモンの開始 start() { echo "Starting lume-watcher..." monitor_directory & |