Syntax for creating a symbolic link to file/folder

  • I would like to create a symbolic link from my Pi to a files on my Windows NAS. The ip address is 192.168.0.20, and the folder is called XBMC Data and the file name is advancedsettings.xml. Can someone help me out?

    In add, what would be the syntax to link to a folder?

    Thanks....

    • Official Post

    NB: You will need to use a custom Kodi systemd service to add a dependency on the network mount being available, or you will have issues when Kodi starts and the NAS drives are asleep and need to be spun up for the mount to complete. It can take 20-30 seconds on some NAS units. For sake of avoiding copying as.xml to the local system it's probably not worth the effort.

  • Thanks for everyone's input....but I don't want to mount a network drive....I want to create a symlink (I believe that is the correct name for the Linux function). I was trying to replicate what I do for my various Windows boxes.....

    Johnny

    • Official Post

    CvH If I understand it correctly, the file advancedsettings.xml is located on a windoze NAS and wants to link to the Pi which I assume is running LE.

    Why! I have no idea, but the only reasons I can think of is either, they are running multiple Kodi systems and want to have a central file (Which in my opinion is a bad way of doing it - far better to have a mysql DB for all instances) or it's easier to edit on the windoze box.

  • CvH If I understand it correctly, the file advancedsettings.xml is located on a windoze NAS and wants to link to the Pi which I assume is running LE.

    Why! I have no idea, but the only reasons I can think of is either, they are running multiple Kodi systems and want to have a central file (Which in my opinion is a bad way of doing it - far better to have a mysql DB for all instances) or it's easier to edit on the windoze box.

    You are partially correct.....

    I do have a MySQL database that keeps track of all the content and it resides on my NAS. What I have have been doing over the last several years is to create a symbolic link to my advancesettings.xml and sources.xml that resides on the NAS and have all of the various devices utilize those. It make setting up a new Kodi box drop dead simple for me.

    I have not experienced any issues with the way my systems are configured.....to each their own. Anyway, I was just interested in how to create a symbolic link in LE since I am a total noob when it comes to linux.

    I did not mean to create controversy.

    Johnny

    • Official Post

    Windows allows "shortcuts" to files and folders on remote shares and accessing the local shortcut triggers access to the remote target object. Linux only allows symlinks to objects in a local filesystem so it's your responsibility to ensure the remote share has been locally mounted before Kodi starts and attempts to access the always-local target for the symlink.

    Doing this at boot time is not impossible but requires more changes than creating a symlink. It would be easier to create a shell script that can be run via at a "safe" time (e.g. 4am) via cron that mounts the remote drive, compares remote file(s) to local file(s) and if there's a difference you stop Kodi, copy the new file and restart Kodi. There single boot-time script hook in LE (autostart.sh) runs at the very start of boot before the network is up so working with remote files requires task-scheduling trickery. There's also a python startup script function within Kodi itself which could do the same thing .. but you end up with an annoying startup process where sometimes (always when a wife wants to watch something) Kodi starts and then stops and restarts "with no apparent explanation" etc.