IP address needed to start daemon?!

Help
Anonymous
2011-07-09
2013-05-29
  • Anonymous - 2011-07-09

    Hello all,

    I installed version 1.0.20 today and so far having a great experience with a PS3, thank you.

    As I intend to run minidlna continuously as a daemon, I had created a startup script and added it to various runlevels. Unfortunately my WiFi is not yet associated with any access point and thus has no IP address at startup - which results in the daemon spitting out "No IP address automatically detected!" and exiting.

    Is there any way around it? How do you manage the starting of minidlna on your machines?

    (I am curious whether there is an easy way to tell minidlna to bind to all IP addresses - even ones who whose interfaces will be up in the future - or whether this would need some code that actively re-examines all available interfaces every now and then and binds the daemon to new ones that pop up.)

    any help would be greatly appreciated,
    gohai

     
  • Cecil Coupe

    Cecil Coupe - 2011-07-09

    For me, my dlna server is a Buffalo NAS running debian on a wired eth0 connections so I assign it a static IP when the NAS boots. That probably doesn't help you.

    However, if your running debian or Ubuntu, I just discovered that it has a new way of managing the boot processes called upstart.  http://upstart.ubuntu.com/cookbook/ That will be a deep dive but it looks like it might work in your situation if you can find the proper events and wire into them.

     
  • Justin Maggard

    Justin Maggard - 2011-07-14

    The problem is, we have to send our IP address back to the client in just about every type of response.  So if we were to blindly bind to all interfaces, we would have to constantly call getifaddrs() to see if our network configuration changed.

     
  • Anonymous - 2011-07-15

    Could calling getifaddrs() with a reasonable delay between not work? (e.g. every 30 seconds)

    Or how about handling a signal (SIGUSR1?) that could be easily (and rather indiscriminatorily) send from if-up.d? (I am not sure, but I hope that the interface is only brought up after the IP address from the DHCP server has been established..)

    Thanks

     
  • wadevoe

    wadevoe - 2011-08-24

    I had a similar problem WRT minidlna starting before eth0 had an IP address.  I ended up disabling starting minidlna via the /etc/rc.d/… method and made a short script to start if after eht0 is 'up'.  I put a script called 50minidlna in the /etc/NetworkManger/dispatcher.d directory which will restart minidlna via the 'service' command when it sees eth0 go up and stop minidlna when it sees eth0 go down.  It works on my Ubuntu box which is using NetworkManger.  Alternatively, there should be a way to do this using the /etc/network/if-up.d for 'non-NetworkManager' machines.

    So far this approach is working out.

    Here is the script:

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    #!/bin/sh
    echo `date` $1 $2 $0 >> /var/testupdown;
    if [ "$1" = "eth0" ]; then
      if [ "$2" = "up" ]; then
        /usr/sbin/service minidlna restart
        exit 0
      elif [ "$2" = "down" ]; then
        /usr/sbin/service minidlna stop
        exit 0
      else
        exit 0
      fi
    fi
    
     
  • Anonymous - 2011-12-09

    same issue here with ubuntu 11.10. while 10.04 was fine. guess the startup time got optimized so network takes a bit longer??

    anyways I add a sleep time to sudo gedit /etc/rc.local

    echo `date +%Y-%m-%d_%H%M%S`____$(uname -n)____Start  on $(date) > /tmp/t-bootup.log
    ping localhost -i 5 -c 5 >> /tmp/t-bootup.log
    sleep 10
    sudo /etc/init.d/minidlna restart >> /tmp/t-bootup.log
    echo `date +%Y-%m-%d_%H%M%S`____$(uname -n)____Finish on $(date) >> /tmp/t-bootup.log
    exit 0
    

    LOG

    2011-12-08_235622____t-ubuntu____Start on Thu Dec 8 23:56:22 PST 2011
    PING localhost (127.0.0.1) 56(84) bytes of data.
    64 bytes from localhost (127.0.0.1): icmp_req=1 ttl=64 time=0.026 ms
    64 bytes from localhost (127.0.0.1): icmp_req=2 ttl=64 time=0.020 ms
    64 bytes from localhost (127.0.0.1): icmp_req=3 ttl=64 time=0.023 ms
    64 bytes from localhost (127.0.0.1): icmp_req=4 ttl=64 time=0.030 ms
    64 bytes from localhost (127.0.0.1): icmp_req=5 ttl=64 time=0.021 ms
    --- localhost ping statistics ---
    5 packets transmitted, 5 received, 0% packet loss, time 19998ms
    rtt min/avg/max/mdev = 0.020/0.024/0.030/0.003 ms
     * Restarting DLNA/UPnP-AV media server minidlna
       ...done.
    2011-12-08_235652____t-ubuntu____Finish on Thu Dec 8 23:56:52 PST 2011
    
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks