How to and where to put an autostart.sh script
#1
Hi,

I am hoping someone a lot smarter then me can provide me some guidance. I am running Openelec 6 on an intel NUC, that connects to my NAS, via ethernet, shared via SMB using Openelecs built in smb sharing.

For the longest time this has worked perfectly fine but I just had my internet upgraded to a faster speed which included a new router/modem. Since the new router install, it seems openelec starts faster then the network is ready and I get a timed out error when trying to acces my shared drives.

I had an issue back when I was running Openelec 5 where the SMB in openelec stopped working and I used the add network location, instead of the browse smb option and used my NAS login info. This fixed that issue back then, but when I tried it this time, the error still happened which leads me to believe that the network connection is taking longer and Openelec gives up waiting for it. Another thing I have noticed is that there are times that Openelec wil connect normally with the NAS after running for a few minutes. Also, If I reboot the NAS, Openelec wil see the drives on first boot without issue, but the next boot I get the timed out error.

I am going to try using the delay Kodi until network is discovered option when I get home later today, but I have read in multiple places while I was researching this issue that this does not always work and that I should use an autostart.sh script (I have posted the info I found below)

I tried the wait for network option in the openelec settings, but it did not seem to work for me.

Only when I added autostart.sh
#!/bin/sh

# Wait for network to come online....
# The option in OpenELEC to wait for network doesn't work yet.
while true ; do
if ifconfig eth0 | grep -q "inet addr:" ; then
echo "Network is up!"
break
else
sleep 1
fi
done

I have googled autostart.sh and I have yet to find any clear info on how to create etc this script so I was hoping someone could simply explain the following if its not to much trouble.

1) Where would I find this script in OpenElec( I can access openelec via my mac over the network and I have succsesfully added a keymap for my harmony remote so I am comfortable doing this)

2)If there is no autostart.sh script by default in OpeneElec, where would I save this script after creating it.

3)If I have to create this script how and with what program would I do this on a mac. Would I just copy and paste the one I noted above into the script, or do i need to make one specific for my situation?

4) If there is an autostart.sh script, how would i modify it to add the above.

Any help anyone could give me with this would be amazing and greatly appreciated. Or, if someone has any other ideas I would love to hear them.

Many thanks
Reply
#2
To make a long story short Wink

http://wiki.openelec.tv/index.php/Autostart.sh

you have to create it. It's all in that wiki
Reply
#3
Hi David1977, thank you for the quick response.

I actually did come across that wiki while I was googling the heck out of y problem. Unfortunately, this just left me with more questions, such as just use nano, well what is nano. I googled that but I'm not sure if its a programming language, just using the word nano in front like on the wiki? I apologise I have no experience "coding or writing script" I just have some experience in browsing and pasting pre made files, scripts etc in their proper place in kodi.

Unfortunately the wiki does not clearly tell me where I would put this script after I create it and how to crete it, would I use notepadd, text editor, notepad ++? Also, It doesn't tell me what commands I should put in, can I just use the one above in my original post?

I apologise for being dificult, but I was thouroughly confused when I was reading about autostart script, and after re reading the wiki several times I am even more confused.

Thank you for trying to help I appreciate it.
Reply
#4
nano is an editor.

You can use it like this:

1. switch to the folder where you want to create the file (done with 'cd' (without the quotes))
2. then enter: nano autostart.sh
3. if all is entered then press CTRL+x, then press "y", then press 'enter' (it's very clear if you see it)

done

Like I said...it's all in the wiki

if you don't know what this or that is, just google it and use proper keywords. For example: "nano linux" will give you good results

BUT!!!

If you only want the "wait for network"-option, why not using the in-built option for that. OpenELEC has that in OpenELEC settings (not to compare with system settings).
Reply
#5
The wiki 100% tells you where the autostart script should be placed.
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#6
There are couple built in scripts in /storage/Configfiles/system.d/ that allow you to mount CIFS or NFS share.
Reply



Logout Mark Read Team Forum Stats Members Help
How to and where to put an autostart.sh script0
This forum uses Lukasz Tkacz MyBB addons.