made a addon wait for external disk

  • Hi.


    I have instaled LibreElec on a NAND unit and I have a side effect comparing to my previous instalation on SD card.


    It's too fast!


    I need to wait unit my external unit is mounted.


    I see it mounted at /var/media/sda-usb-TOSHIBA_MQ01ABD0

    Code
    1. LibreELEC:~/.kodi/addons/service.transmission/system.d # systemctl list-units | grep -i toshiba
    2. var-media-sda\x2dusb\x2dTOSHIBA_MQ01ABD0.mount                                                                            loaded active mounted   /var/media/sda-usb-TOSHIBA_MQ01ABD0



    I have tried this.



    Code
    1. [Unit]
    2. After=network-online.target
    3. Requires=network-online.target
    4. After=var-media-sda\x2dusb\x2dTOSHIBA_MQ01ABD0.mount
    5. Requires=var-media-sda\x2dusb\x2dTOSHIBA_MQ01ABD0.mount


    But not is working, looks like not wait for the unit.


    I have made a workaround putting a "sleep 5s" inside the sh that launch the addon, but I prefer the systemd approach.


    Why is not working?

  • I am surprised to see a backslash in the mount service name.
    You can check for the exact service name with the systemctl command.


    Incidentally, what flavour of service.transmission add-on are you using?
    The one provided by Thoradia allows to define a custom initialization script in /storage/.kodi/addons/service.transmission/init.sh.
    This script is called each time service.transmission is started.
    You can use this script to delay startup, mount a volume, start a (mount) service, etc.

    Keep it legal and carry on


  • I had the exact same problem, solved it by forcing a spin up of the external drive before kodi started. I'm not by my Kodi box right now but I will past the command you need shortly.


    Sent from my SM-G900F using Tapatalk


  • Hi thoradia


    After using my own compilation I have recently moved to your repository. I'm using the version 7.


    This is the result of
    # systemctl list-units | grep -i toshiba

    Code
    1. var-media-sda\x2dusb\x2dTOSHIBA_MQ01ABD0.mount                                                                            loaded active mounted   /var/media/sda-usb-TOSHIBA_MQ01ABD0



    If I add [email protected] the addon looks like start after the unit are mounted, I not see anymore the "Error: No data found", but all my files are in paused status. I don't know why.


    This is my current configuration

    Code
    1. [Unit]
    2. Description=transmission
    3. After=network-online.target [email protected]
    4. Requires=network-online.target [email protected]
    5. #After=var-media-sda\x2dusb\x2dTOSHIBA_MQ01ABD0.mount
    6. #Requires=var-media-sda\x2dusb\x2dTOSHIBA_MQ01ABD0.mount


    BTW I not see the init.sh



    I have modified bin/transmission.start

    Edited once, last by CGarces ().

  • I simply use the following command in the autostart.sh:-


    /bin/dd if=/dev/sdb of=/dev/null count=512


    This forces the external drive to spin up before kodi starts thus ensuring it's available to all services.




    Sent from my SM-G900F using Tapatalk


  • You have to create init.sh yourself, and populate it with commands appropriate to your requirements.
    With system.d, good (sleep 5, mount, etc) sometimes beats best (requires, after) ;)

    Keep it legal and carry on