Welcome to Linux Forums! With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.
Find the answer to your Linux question:
New to Linux Forums? Register here for free!
    Linux Forums > The Community > Everything BSD > Equivalent to chkconfig / update-rc.d on FreeBSD 6.2???

Forgot Password?
 Everything BSD   For all discussions regarding Free/NetBSD and OpenBSD.

Site Navigation
Linux Articles
Linux Forums
Linux Downloads
Linux Hosting
Free Magazines
Job Board
IRC Chat
RSS Feeds


Linux Forum Topics
Linux Forums
Your Distro
Linux Resources
GNU Linux Zone
The Community
Reply
 
Thread Tools Display Modes
Old 02-17-2008   #1 (permalink)
Just Joined!
 
Join Date: Oct 2007
Location: Mexico
Posts: 64
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
Saltamontes is offline  


Reply With Quote
Old 02-17-2008   #2 (permalink)
Trusted Penguin
 
daark.child's Avatar
 
Join Date: Apr 2006
Location: South Yorks, UK
Posts: 4,067
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.
daark.child is offline   Reply With Quote
Old 05-29-2008   #3 (permalink)
Just Joined!
 
Join Date: Oct 2007
Location: Mexico
Posts: 64
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
Saltamontes is offline   Reply With Quote
Old 06-04-2008   #4 (permalink)
Just Joined!
 
Join Date: Oct 2007
Location: Mexico
Posts: 64
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
Saltamontes is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Free Magazines
Run Your Own Web Server Using Linux & Apache - Free 191 Page Preview
Learn about everything you'll need to build and maintain your Linux servers, and to deploy Web applications to them.
subscribe
Open Source Security Myths Dispelled
Dispel the five major myths surrounding Open Source Security and gain the tools necessary to make a truly informed decision for your IT organization
subscribe
InformationWeek
InformationWeek is the only newsweekly you'll need to stay on top of the latest developments in information technology.
subscribe



All times are GMT. The time now is 06:15 AM.






© 2000 - 2009 - All Rights Reserved - Property of  MAS Media

Content Relevant URLs by vBSEO 3.3.0 RC2