You are not logged in.

#1 2017-06-11 14:48:43

7thSon
Member
Registered: 2017-05-07
Posts: 186

Samba timeout/wake?

I'm trying to set up my Kodi media center to be run and do a library update when the source folders are updated with new files.
The script I'm using is below. It's really simple, just open Kodi, wait for quite a long time before starting a library update via a json command to the kodi http server running in the software, then kill Kodi.
All of the things in the script work just fine - the problem I'm having is that the folders that are supposed to be updated in this process are samba shares located on my NAS, and they behave very erratically.
Sometimes the library update goes just fine, but many times it gets stuck right at the beginning with the message "Preparing...". I've read that this has happened to others because of offline sources.
So I think something is making my samba shares not "wake up" to allow Kodi to do the update. I can go into Kodi once and do the update, then 10 seconds later try again and it fails with the "Preparing..." message.

I use XFCE and have mounted the smb:// shares with Autofs and fstab, both with the same result.
Anyone able to point me in the right direction for this, is there something I need to do to keep the samba connection awake?

autofs.master mount line:

/media/DiskStation /etc/autofs/auto.DiskStation --timeout=60 --ghost

auto.DiskStation directory line:

[DSMovies] -fstype=cifs,username=kodi,password=kodi ://DiskStation/Videos

The thing is however that Kodi doesn't use either of the autofs or fstab mount points, but the direct smb://DiskStation/Videos path, which I don't know how to keep awake/active?

Kodi script:

#!/bin/sh

#start kodi
notify-send "Kodi Update" "Starting Kodi... $n" -t 1 --icon kodi
kodi &

n=20
while [ $n -le 100 ]
do
	sleep 3
	notify-send "Kodi Update" "Starting Kodi... $n%" -t 1 --icon kodi
	n=$(( n+20 ))	 # increments $n
done

notify-send "Kodi Update" "Waiting for network..." --icon kodi
sleep 10
notify-send "Kodi Update" "Updating Library..." --icon kodi -t 30000

#update library via json
curl --data-binary '{ "jsonrpc": "2.0", "method": "VideoLibrary.Scan", "id": "mybash"}' -H 'content-type: application/json;' http://kodi:kodi@127.0.0.1:8080/jsonrpc

#wait to finish library update
sleep 30

#kill kodi
notify-send "Kodi Update" "Finished - Exiting Kodi..." --icon kodi
pkill -f -SIGKILL kodi.bin

exit

Last edited by 7thSon (2017-06-11 17:08:31)

Offline

#2 2017-06-20 19:05:44

7thSon
Member
Registered: 2017-05-07
Posts: 186

Re: Samba timeout/wake?

No input from anybody? hmm

Offline

Board footer

Powered by FluxBB