Find the answer to your Linux question:
Results 1 to 4 of 4
Hello to All The title says all I have using Linux ( Debian, Mandriva, CentOS ) because im trying to "stand up" an IDS . . . Now im trying ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2007
    Location
    Mexico
    Posts
    65

    Equivalent to chkconfig / update-rc.d on FreeBSD 6.2???


    Hello to All

    The title says all

    I have using Linux ( Debian, Mandriva, CentOS ) because im trying to "stand up" an IDS . . .

    Now im trying FreeBSD 6.2 because looks very interesting, and the writer of a book wich i have reading uses FreeBSD.

    And i will try to duplicate the IDS with FreeBSD.

    Now... the main parts of the IDS are te Server (store data on a DB) and a Sensor, both uses startup scripts to start on boot, and chkconfig / update-rc.d are used for that.

    ( that scripts located in /etc/init.d on Linux )

    Which command is used for adding a statup script on boot ???
    ( or i have to copy someting to rc1, rc2 . . . by hand ? )

    Thanks to all

  2. #2
    Blackfooted Penguin daark.child's Avatar
    Join Date
    Apr 2006
    Location
    West Yorks
    Posts
    4,393
    You edit /etc/rc.conf and add something like
    Code:
    service_enable="YES"
    To start the service immediately without rebooting,
    Code:
    /usr/local/etc/rc.d/service start
    You may have to adjust your path depending on where the service is installed. If you created your own startup script, you probably should save it in /usr/local/etc/rc.d. Also take a look at the FreeBSD handbook because it has more details about managing services.

  3. #3
    Just Joined!
    Join Date
    Oct 2007
    Location
    Mexico
    Posts
    65
    Hello again

    i have been "playing" with FreeBSD again (now 7.0), and i'm interested to load some scripts on startup (i dont know if is necesary to convert them in daemons)...

    that scripts was written for Red Hat like distributions, and with some fixes can run in Debian...

    i have cheked that part of handbook that you talk about (Starting Services)

    then, i have to add that part:
    ...
    utility_enable=${utility_enable-"NO"}
    utility_flags=${utility_flags-""}
    utility_pidfile=${utility_pidfile-"/var/run/utility.pid"}
    ...

    in order to load that scripts (and executhe their tasks) on boot???

    The scripts have this form (for Red Hat "chkconfig")
    Code:
    #!/bin/bash
    # chkconfig: 2345 80 13
    # description: Starts and stops SGUIL security monitoring server. \
    
    # Source function library.
    . /etc/init.d/functions
    
    # Source networking configuration.
    . /etc/sysconfig/network
    
    # Check that networking is up.
    [ ${NETWORKING} = "no" ] && exit 0
    
    sguild="/usr/local/sguil/server/sguild"
    prog="sguild"
    sguil_user="sguil"
    
    start() {
        echo -n $"Starting $prog: "
        RETVAL=0
        daemon --user $sguil_user $sguild -P /var/run/sguil/sguild.pid -O /usr/local/tcltls/lib/libtls1.50.so -D
    
        RETVAL=$?
        echo
    }
    
    stop() {
        echo -n $"Shutting down $prog: "
        kill -9 `ps -auxww | grep tclsh | grep sguild | awk '{print $2}'`
        echo
    }
    
    status() {
        NUM_PROCS=`ps -auxww | grep tclsh | grep sguild | grep -v grep | awk '{print $2}' | wc -l`
    
        if [ $NUM_PROCS -eq 3 ]; then
            echo "Sguild daemon is UP"
            exit 0
        else
    	# The funky sed is necessary to chop some extra spaces before 
    	# $NUM_PROCS, which were inserted by the output from "wc -l" above.
            echo "Sguild daemon is DOWN ($NUM_PROCS/3 processes up)" | sed -e 's/\s\s//g'
            exit -1
        fi
    }
    
    # See how we were called.
    case "$1" in
      start)
    	start
    	;;
      stop)
    	stop
    	;;
      restart|reload)
    	stop
    	sleep 3
    	start
    	;;
      status)
    	status 
    	;;
      *)
    	echo $"Usage: $0 {start|stop|restart|status}"
    	exit 1
    esac
    Thanks to everybody

    See you

  4. $spacer_open
    $spacer_close
  5. #4
    Just Joined!
    Join Date
    Oct 2007
    Location
    Mexico
    Posts
    65
    Solved.

    i did it, and the solution is shown in the post "custom script don't run on boot".

    i can't solve the start/stop/restart options with the "good way", i did a complementary script using "kill + grep", and "rm -f pidfile", is not elegant, but works.

    also, i can see something, the startup script dont works if is located on /usr/local/etc/rc.d/ only works on /etc/rc.d, i dont know why.

    Thanks anyway

    See you

Posting Permissions

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