correct isinotifywaitRunning for xbian

This commit is contained in:
qo-op 2021-03-06 20:00:25 +01:00
parent 758ea4ee57
commit f6d26e1ffd
1 changed files with 8 additions and 11 deletions

View File

@ -49,7 +49,6 @@ ping -q -w 1 -c 1 `ip r | grep default | cut -d ' ' -f 3` 2>&1>/dev/null && echo
### MODIFY WITH GREAT CARE!!! MUST BE BUG FREE !!!!!
### EVERY STATION RUN THIS SCRIPT EVERY MINUTE.
export isKodiRunning=$(ps auxf --sort=+utime | grep -w kodi | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d ' ' -f 1)
export isinotifywaitRunning=$(ps auxf --sort=+utime | grep -w inotifywait | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d ' ' -f 1)
########################################################################
cd $MY_PATH
@ -94,22 +93,20 @@ fi
# __ _| |__ (_) __ _ _ __
# \ \/ / '_ \| |/ _` | '_ \
# > <| |_) | | (_| | | | |
# /_/\_\_.__/|_|\__,_|_| |_| ASTROPORT youtube mp3
# /_/\_\_.__/|_|\__,_|_| |_| ASTROPORT
#
# ON Rpi/xbian files added in ~/astroport are monitored to activate "new_file_in_astroport.sh"
# Transfert ~/astroport/*/files to IPFS and make Vstream/ASTROPORT indexes in IPNS
# Transfert ~/astroport/*/files to IPFS and make Astroport/KODI indexes in IPNS
if [[ "$USER" == "xbian" ]]; then
# LAUNCH inotifywait
if [[ ! $isinotifywaitRunning ]]; then
mkdir -p /home/$YOU/astroport
[[ ! -e /home/$YOU/astroport ]] && mkdir -p /home/$YOU/astroport
# VERIFY LAUNCH inotifywait ?!
inotifywaitRunning=$(ps auxf --sort=+utime | grep -w inotifywait | grep -w astroport | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d ' ' -f 1)
if [[ "$inotifywaitRunning" != "xbian" ]]
then
/usr/bin/inotifywait -r -e close_write -m /home/$YOU/astroport | while read dir flags file; do $MY_PATH/zen/new_file_in_astroport.sh "$dir" "$file"; done &
fi
# RESTART inotifywait (may be useless)
if [[ "$timebar" == "03:03" ]]; then
killall inotifywait
fi
fi
## TODO investigate could breaks "ipfs p2p" forwards ?
##################################################################