Why I get status: Unknown job on the service?

16,868

Your script is an init.d script. The status command is for Upstart jobs; not for init.d scripts.

initctl list is used to list all Upstart jobs. If you try it, you'll find that noip2 isn't there. In fact, you'll find that none of the scripts from /etc/init.d are shown by that command. initctl list (and the status command you tried), works with the Upstart configuration files from /etc/init (note the lack of .d) only.

The command to check the status of a script from /etc/init.d is usually:

# service <script> status

However, for that to work, the script must support a status function, which yours doesn't.

Your script has three options: start, stop and restart which means that these are the only three commands you can pass to service noip2 <cmd>. If you read others within /etc/init.d you'll find that they have more options, such as status.

In fact, if you read the article in the link you posted, you'll see that the way to check the status of noip2 is:

$ sudo /usr/local/bin/noip2 –S
Share:
16,868

Related videos on Youtube

abolmabol
Author by

abolmabol

Updated on September 18, 2022

Comments

  • abolmabol
    abolmabol over 1 year

    I followed this tutorial to add a program to init.d as a service (I guess), when I want to see its status with:

    sudo status /etc/init.d/noip2
    

    I get :

    status: Unknown job: /etc/init.d/noip2
    

    What it mean? should I change the program?

    Program is:

    #! /bin/sh
    
    # /etc/init.d/noip2
    # Supplied by no-ip.com
    # Modified for Debian GNU/Linux by Eivind L. Rygge <[email protected]>
    # Updated by David Courtney to not use pidfile 130130 for Debian stable.
    
    # . /etc/rc.d/init.d/functions  # uncomment/modify for your killproc
    
    DAEMON=/usr/local/bin/noip2
    NAME=noip2
    
    test -x $DAEMON || exit 0
    
    case "$1" in
       start)
           echo -n "Starting dynamic address update: "
           start-stop-daemon –start –exec $DAEMON
           echo "noip2."
       ;;
    
       stop)
           echo -n "Shutting down dynamic address update:"
           start-stop-daemon –stop –oknodo –retry 30 –exec $DAEMON
           echo "noip2."
       ;;
    
       restart)
           echo -n "Restarting dynamic address update: "
           start-stop-daemon –stop –oknodo –retry 30 –exec $DAEMON
           start-stop-daemon –start –exec $DAEMON
           echo "noip2."
       ;;
    
       *)
           echo "Usage: $0 {start|stop|restart}"
           exit 1
       ;;
    
    esac
    exit 0
    
  • garethTheRed
    garethTheRed almost 10 years
    service noip2 stop.