Results 1 to 4 of 4

Thread: start daemon on boot - init.d script

  1. #1

    Default start daemon on boot - init.d script

    Hey,

    I compiled the LPFW ( Leopard Flower Personal Firewall) and want to start the daemon automatically on each boot. For this, I thought a init.d script would be what I need (please correct me if I'm wrong). It looks like:

    lpfw.conf:
    Code:
    #!/bin/bash
    LPFW=/usr/bin/lpfw
    KILLALL=/usr/bin/killall
    
    case "$1" in
        start)
            echo "Starting lpfw..."
            $LPFW
            ;;
        stop)
            echo "Stopping lpfw..."
            $KILLALL lpfw        
            ;;
        restart)
            $0 stop
            $0 start
            ;;
        status) wor
            ;;
        *)
            echo "Usage: $0 {start|stop|restart|status}"
            ;;
    esac
    And it should be executable:
    Code:
    /etc/init.d> ls -l lpfw.conf 
    -rwxr-xr-x 1 root root 378 Dec 26 18:42 lpfw.conf
    But unfortunately, when I check after login whether lpfw is running with pgrep, I see its not. However, starting the script directly with root privileges works fine:
    Code:
    /etc/init.d> sudo ./lpfw.conf start
    Starting lpfw...
    What am I doing wrong? are the init.d script started as root? What is the correct log to check for errors during executing these scripts?
    Thanks for your help in advance!

  2. #2
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: start daemon on boot - init.d script

    On 2013-12-26 18:56, booo123 wrote:
    >
    > Hey,
    >
    > I compiled the LPFW ( Leopard Flower Personal Firewall) and want to
    > start the daemon automatically on each boot. For this, I thought a
    > init.d script would be what I need (please correct me if I'm wrong). It
    > looks like:


    Yep, you are wrong :-)

    We no longer use systemv, but systemd. No longer /etc/init.d/* scripts.

    There is a chapter on the book for it.

    --
    Cheers / Saludos,

    Carlos E. R.
    (from 13.1 x86_64 "Bottle" (Elessar))

  3. #3
    Join Date
    Sep 2012
    Posts
    7,091

    Default Re: start daemon on boot - init.d script

    Quote Originally Posted by booo123 View Post
    want to start the daemon automatically on each boot. For this, I thought a init.d script would be what I need (please correct me if I'm wrong).
    To start on boot you need scripts under /etc/init.d/rc?.d (usually it would be /etc/init.d/rc3.d or rc5.d). Scripts in /etc/init.d are not used during boot directly - they are used by command chkconfig to create links in above mentioned directories. For this scripts need to have special comments that contain instructions for chkconfig. Look at some existing scripts for examples.

  4. #4
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    29,721

    Default Re: start daemon on boot - init.d script

    You forgot to mention which version of openSUSE you use. Thus you might get contradictionary answers. Some based on SysVinit and some on Systemd.
    Henk van Velden

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •