How do you mount a Windows directory with autostart.sh?

  • This is out my autostart.sh looks:

    Bash
    #!/bin/sh(
    mount -t cifs //192.168.1.64/Network /storage/Byte-Knight -o username=MyWinUsername,password=MyWinPassword
    )&

    I created the Byte-Knight folder in the storage directory.

    I can connect to the shared directory through the file explorer just fine.

    Is there something I'm not doing right?

    Trying to add the directory to Plex server but it can't be added unless it's mounted it seems.

    Edit: There was an extra colon, I removed it, and it's working now!

    • Official Post

    This has a high probability of failure because autostart.sh is executed right at the start of userspace boot before the network stack is up. If you run the script in the background (as you are) you need to add sleep values to allow the network to come up, and you probably need to delay Kodi start to allow for the mount to happen first.

    This is why systemd mounts exist. Systemd allows you to apply dependencies, e.g. so the mount "wants" the network target to be up, and "before" the Kodi service is started. Look at the examples in /storage/.config/system.d/

  • Hello

    Try this script, it works reliably for me under Ubuntu.

    Maybe also with Libreelec.