init.d.script

Stedy
2009-03-11
2013-05-29
  • Stedy

    Stedy - 2009-03-11

    Hello have tried to get the minidlna.init.d.script   to work  on my ubuntu 8.10 desktop pc, whitout any sucsess...
    I hope somebody here could help me out..

    This i wat i ave done:
    1. placed minidlna binary in /usr/sbin/ and minidlna.conf in /etc/
    2. copy the minidlna.init.d.script to /etc/init.d and renamed it minidlna.
    3. sudo chmod 755 /etc/init.d/minidlna
    4. sudo update-rc.d minidlna defaults

    5. tested the script with: "/etc/init.d/minidlna start"    This brings minidlna up as a running process.

    I then restarted my computer and hoped that the system would bring minidlna up during boot time.. but this does not happend.. cant find anything in my syslog monitor abut minidlna...

    Is there anything I do wrong?
    I also tried to put in the following text at top init.d script..

    ### BEGIN INIT INFO
    # Provides:          minidlna
    # Required-Start:    $network
    # Required-Stop:    
    # Default-Start:      3 5
    # Default-Stop:      0 1 2 4 6
    # Should-Start:      minidlna
    # Should-Stop:      
    # Short-Description: start minidlna daemons
    ### END INIT INFO

     
    • Justin Maggard

      Justin Maggard - 2009-03-11

      Try this:
      # update-rc.d minidlna defaults

       
    • Stedy

      Stedy - 2009-03-12

      yes, i have tried that as in step 4.. and after I edited the script.

       
    • Justin Maggard

      Justin Maggard - 2009-03-12

      What was the output you got when running the update-rc.d script?  Anyway, you should be able to do it manually also.

      With your system fully booted, type:
      # runlevel
      to figure out what runlevel you're usually operating in.  If it's 5, then look in /etc/rc5.d/ for anything with a name ending with minidlna.  If it's not there, you should just be able to do:
      # ln -s /etc/init.d/minidlna /etc/rc5.d/S90minidlna

       
    • Stedy

      Stedy - 2009-03-12

      runleve output gave N 2.

      the output whit your script is:

      update-rc.d: warning: /etc/init.d/minidlna missing LSB style header
      Adding system startup for /etc/init.d/minidlna ...
         /etc/rc0.d/K20minidlna -> ../init.d/minidlna
         /etc/rc1.d/K20minidlna -> ../init.d/minidlna
         /etc/rc6.d/K20minidlna -> ../init.d/minidlna
         /etc/rc2.d/S20minidlna -> ../init.d/minidlna
         /etc/rc3.d/S20minidlna -> ../init.d/minidlna
         /etc/rc4.d/S20minidlna -> ../init.d/minidlna
         /etc/rc5.d/S20minidlna -> ../init.d/minidlna

      and after I added LSB header:

      ### BEGIN INIT INFO
      # Provides:          minidlna
      # Required-Start:    $network $syslog
      # Required-Stop:   
      # Should-Start:     
      # Should-Stop:      
      # Default-Start:     2 3 4 5
      # Default-Stop:      0 1 6
      # Short-Description: Starts minidlna daemon.
      # Description:       MiniDlna is used to serve mp3 and pictures to Bravia 46W4500
      ### END INIT INFO

      The output is:

      /etc/rc0.d/K20minidlna -> ../init.d/minidlna
         /etc/rc1.d/K20minidlna -> ../init.d/minidlna
         /etc/rc6.d/K20minidlna -> ../init.d/minidlna
         /etc/rc2.d/S20minidlna -> ../init.d/minidlna
         /etc/rc3.d/S20minidlna -> ../init.d/minidlna
         /etc/rc4.d/S20minidlna -> ../init.d/minidlna
         /etc/rc5.d/S20minidlna -> ../init.d/minidlna

      I have also manual added
      # ln -s /etc/init.d/minidlna /etc/rc2.d/S90minidlna  whit no sucess..

      but i have notice that when i run minidlna manualy i get a error:
      ./minidlna -f minidlna.conf -d
      [2009/03/12 20:35:51] daemonize.c:76: error: Unable to open pidfile for writing /var/run/minidlna.pid: Permission denied

      and when then end the program using CTRL-C:
      minidlna.c:109: warn: received signal 2, good-bye
      [2009/03/12 20:37:45] minidlna.c:884: error: Failed to remove pidfile /var/run/minidlna.pid: No such file or directory
      I dont run as root so it make some sense.

      But could this be the problem for the init.d case as well?

       
    • Justin Maggard

      Justin Maggard - 2009-03-22

      The only thing I can think of would be if minidlna is trying to start before the network interface is up.  Are you using NetworkManager or ifplugd?  If so, you would have to start it from the scripts for those programs.

       
    • Martin Tittel

      Martin Tittel - 2009-06-09

      Did you solve the problem already?

      I am experiencing the same behaviour on Debian Lenny on my NSLU2: Starting the demon manually works fine, but starting it automatically while booting doesn't work...

      My runlevel output is N 2.

      I tried several methods (as described above):
      update-rc.d minidlna defaults
      ln -s /etc/init.d/minidlna /etc/rc2.d/S99minidlna
      and also "/etc/init.d/minidlna start" in /etc/rc.local
      none of them worked...

      Regards,
      Martin

       
      • Justin Maggard

        Justin Maggard - 2009-06-09

        Your system needs to have an IP address when minidlna starts, so perhaps that's the problem?  Are you using NetworkManager to handle the network interfaces?  You could add a line like "/usr/sbin/minidlna &> /tmp/minidlna.log" to /etc/rc.local, and see what the error message is.

         
    • Martin Tittel

      Martin Tittel - 2009-06-09

      I do not use NetworkManager (as far as I know...)
      Adding "/usr/sbin/minidlna &> /tmp/minidlna.log" to /etc/rc.local produces a logfile of zero bytes length and minidlna is not running after boot.
      I also tried "/usr/sbin/minidlna -f /etc/minidlna.conf &> /tmp/minidlna.log" in /etc/rc.local, same result.

       
    • Sean Mahnken

      Sean Mahnken - 2009-08-22

      I'm running into a similar issue.  minidlna starts just fine when invoked manually post-boot, but doesn't work when invoked from an init.d script.

      Taking a cue from Justin's statement about needing a valid IP, I decided to try inserting a pause in the init.d script to give the network time to allocate the IP:

      # Pause for IP
      sleep 5
      # Start minidlna
      /sbin/startproc /usr/sbin/minidlna

      I was surprised to find that this actually causes a Segmentation fault to show up.

      Out of curiosity, I also added the pause AFTER the start of minidlna like this:

      # Start minidlna and pause for a bit
      /sbin/startproc -t 5 /usr/sbin/minidlna

      The result?  Segmentation fault. 

      The problem is I can't tell you where.  I tried starting minidlna with the -d flag, but I'm not sure where the output went to (it didn't show up on stdout...).

       
    • Stedy

      Stedy - 2009-08-28

      I tried the init.d on a ubuntu server whit Webmin, past the code directly into webmin's Edit Action in the Bootup and Shutdown configuration, for a custom made  "bootup and shutdown action".  it actual works....
      I found the script where placed in rc2.d , rc3.d and rc5.d named 99minidlna by Webmin.

      I guess there Is something whit user privileges thats cause the script to fail on ubuntu systems. Webmin runs every proses as root.

      I have never reported this as a bug, but I have noticed for many(all??)  cvs version of minidlna I have tested that when I start it as a regular user then i cause one error:

      nn@desktop:~/workspace/minidlna$ ./minidlna -f minidlna.conf -d
      [2009/08/29 00:19:22] daemonize.c:76: error: Unable to open pidfile for writing /var/run

      So if ubuntu dont run inti.d scripts as root then the init.d script cant manage to create the pidfile??

      start)  log_daemon_msg "Starting minidlna" "minidlna"
              start-stop-daemon --start --quiet --pidfile /var/run/minidlna.pid --startas $MINIDLNA -- $ARGS $LSBNAMES
              log_end_msg $?
              ;;

       
      • Justin Maggard

        Justin Maggard - 2009-09-01

        The pidfile isn't required to start.  You can also specify the pidfile location to another path with the -P option to make sure.  For example:
        # minidlna -P /tmp/minidlna.pid

         
  • Leonardo Silva Amaral

    I've created a full (But not quite yet) initialization script for Ubuntu. I think Ubuntu version isnt a problem, and only thing i think i need to do is a way to log it.

    Here is a diff (Can be applied with sudo patch -p0 < filename.patch) .

      : http://pastebin.ca/1572522

     
  • Stedy

    Stedy - 2009-10-07

    This issue seams like it is solved now, -i run Ubuntu 8.10

    sudo cp  minidlna.init.d.script  /etc/init.d/minidlna

    sudo chmod +x /etc/init.d/minidlna

    sudo update-rc.d minidlna defaults

    to remove the startup schript then :
    sudo update-rc.d -f minidlna remove

     

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

Sign up for the SourceForge newsletter:





No, thanks