[GH-ISSUE #1157] Inotify script alternative for CIFS network shares? #668

Closed
opened 2026-02-26 02:33:54 +03:00 by kerem · 2 comments
Owner

Originally created by @vmario89 on GitHub (Dec 28, 2019).
Original GitHub issue: https://github.com/koel/koel/issues/1157

Hi,
having this sync script with inotify, running as systemd service

#!/bin/bash

# this script does not work for network shares like CIFS mounts! Inotify only works for local filesystem!

PID_FILE="/opt/koel/koel-watch.pid"
MEDIA_PATH=/mnt/koel-music-share
PHP_BIN=/usr/bin/php

case "$1" in
start)
        #get the scripts own PID number
        echo $$>"$PID_FILE"
        inotifywait -rme move,close_write,delete --format "%e %w%f" $MEDIA_PATH | while read file; do
                $PHP_BIN artisan koel:sync "${file}" > /opt/koel/koel-watch.log 2>&1
        done
         ;;

stop)
   #kill `cat "$PID_FILE"`
   pkill -P `cat "$PID_FILE"`
   #kill -9 `cat "$PID_FILE"`
   rm "$PID_FILE"
   ;;

restart)
   $0 stop
   $0 start
   ;;

status)
   if [ -e "$PID_FILE" ]; then
      echo Service is still running, pid=`cat "$PID_FILE"`
   else
      echo Service  is NOT running
      exit 1
   fi
   ;;

*)
   echo "Usage: $0 {start|stop|status|restart}"
esac

exit 0

i figured out it wont work on network shared drive. Because i put my music on synology NAS drive (and not using the synology audio station because its slow software).

Has anyone found out some way on how to monitor file changes on network drive?
The only working way to sync koel at the moment is by triggering cron script to sync the complete file system at interval X.

Originally created by @vmario89 on GitHub (Dec 28, 2019). Original GitHub issue: https://github.com/koel/koel/issues/1157 Hi, having this sync script with inotify, running as systemd service ``` #!/bin/bash # this script does not work for network shares like CIFS mounts! Inotify only works for local filesystem! PID_FILE="/opt/koel/koel-watch.pid" MEDIA_PATH=/mnt/koel-music-share PHP_BIN=/usr/bin/php case "$1" in start) #get the scripts own PID number echo $$>"$PID_FILE" inotifywait -rme move,close_write,delete --format "%e %w%f" $MEDIA_PATH | while read file; do $PHP_BIN artisan koel:sync "${file}" > /opt/koel/koel-watch.log 2>&1 done ;; stop) #kill `cat "$PID_FILE"` pkill -P `cat "$PID_FILE"` #kill -9 `cat "$PID_FILE"` rm "$PID_FILE" ;; restart) $0 stop $0 start ;; status) if [ -e "$PID_FILE" ]; then echo Service is still running, pid=`cat "$PID_FILE"` else echo Service is NOT running exit 1 fi ;; *) echo "Usage: $0 {start|stop|status|restart}" esac exit 0 ``` i figured out it wont work on network shared drive. Because i put my music on synology NAS drive (and not using the synology audio station because its slow software). Has anyone found out some way on how to monitor file changes on network drive? The only working way to sync koel at the moment is by triggering cron script to sync the complete file system at interval X.
kerem 2026-02-26 02:33:54 +03:00
Author
Owner

@BrookeDot commented on GitHub (Apr 22, 2020):

Has anyone found out some way on how to monitor file changes on network drive?
The only working way to sync koel at the moment is by triggering cron script to sync the complete file system at interval X.

Currently using cron is the only supported method for syncing since partial syncs are not supported. Recently #1214 was opened regarding background sync.

I think having a feature that allows partial syncs would be neat but not something that's support (that I know of) today.

<!-- gh-comment-id:617581217 --> @BrookeDot commented on GitHub (Apr 22, 2020): > Has anyone found out some way on how to monitor file changes on network drive? The only working way to sync koel at the moment is by triggering cron script to sync the complete file system at interval X. Currently using cron is the only supported method for syncing since partial syncs are not supported. Recently #1214 was opened regarding background sync. I think having a feature that allows partial syncs would be neat but not something that's support (that I know of) today.
Author
Owner

@phanan commented on GitHub (Oct 18, 2022):

Closing as you can now just upload via the web interface.

<!-- gh-comment-id:1282472997 --> @phanan commented on GitHub (Oct 18, 2022): Closing as you can now just upload via the web interface.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/koel-koel#668
No description provided.