yup thank you for others who may be interested this is how I am doing it:
1st I have this script running to subscribe to the mqtt topic:
mqtt_sub.sh
#!/bin/bash
while true
do
/volume1/mosquitto/mosquitto_sub -L mqtts://username:password@host.com /plex/updates --cafile /etc/ssl/certs/ca-certificates.crt | while read -r payload
do
/volume1/plex_refresh.sh "${payload}" &
done
sleep 10 # Wait 10 seconds until reconnection
done
as above that calls plex_refresh.sh
plex-refresh.sh
> #!/bin/sh
> PLEXPATH="$@"
> PLEXMOUNT="/mnt/gdrive.de"
> TYPE=`/usr/bin/echo $PLEXPATH | /usr/bin/cut -d"/" -f 1`
> if [ $TYPE == "TV" ]; then
> SECTION=2
> else
> SECTION=1
> fi
> /volume1/rclone/rclone rc vfs/refresh dir="$PLEXPATH" --rc-user=rclone --rc-pass=rclone --rc-addr=10.0.1.3:5572 --config=/volume1/rclone.conf
> /usr/bin/sleep 10
> export LD_LIBRARY_PATH="/var/packages/Plex Media Server/target"
> export PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR="/volume1/Plex/Library/Application Support"
> echo "scanning $@"
> "$LD_LIBRARY_PATH/Plex Media Scanner" --scan --refresh --section "$SECTION" --directory "$PLEXMOUNT/$PLEXPATH"
EDIT://
this has been marked up here due to issue with identifying new subfolders in the cache: VFS Refresh Directory - #3 by drpau