Results 1 to 6 of 6

Thread: share your /etc/rc.d/rc.local file!

  1. #1

    share your /etc/rc.d/rc.local file!

    hi all,
    here is my /etc/rc.d/rc.local file, nothing special:

    #!/bin/sh
    #
    #/etc/rc.d/rc.local: Local system initialization script.
    #
    # =====================================================================================================================
    # ---- WRITTEN BY: "HackerzMaster":--------------
    # =====================================================================================================================
    #
    # Checking the network, and starting DHCP:
    #
    if [ -x /sbin/dhcpcd ]; then
    dhcpcd ath0
    if [ $? -eq 0 ] ; then
    echo -e "starting ath0 interface... \t\t\t\t\t\t\t\t\t\t\t\c"
    echo "done"
    else echo -e "starting ath0 interface... \t\t\t\t\t\t\t\t\t\t\t\c"
    echo 'network is down '
    fi
    fi

    # Checking if the gateway is connected (online):
    #
    ping -c 1 -w 5 linksys 1> /dev/null 2>&1
    if [ $? -eq 0 ] ; then
    ping -c 1 -w 10 google.com 1> /dev/null 2>&1
    echo '<you are online>'
    /home/hani/scripts/getath0.sh 2> /dev/null
    else echo '<you are offline>'
    fi


    # Turn numlock on:
    for tty in /dev/tty[1-6]; do
    /usr/bin/setleds -D +num < $tty
    done

    # Setting time to Universal Time Coordinate (UTC), setting system time to hardware clock:
    echo "Setting time to Universal Time Coordinate (UTC)" ;
    ntpdate asia.pool.ntp.org > /dev/null 2>&1
    hwclock --utc --systohc

    # Start hci0 bluetooth interface, scanning neighborhood for devices:
    echo starting bluetooth...
    hciconfig hci0 up 2> /dev/null
    if [ $? -eq 0 ] ; then
    hcitool scan
    else echo '<no bluetooth adapter found>'
    fi
    # Starting firewall:
    echo restarting firewall
    /linux/firewall-jay-1.0.5/files/fw-jay restart > /dev/nul 2>&1

    # Setting the ip_foward variable, useful for some progs
    ip_forward=/proc/sys/net/ipv4/ip_forward

    # Displaying my TODO list
    cat /home/hackerzmaster/TODO


    # F.Y.I getath0.sh:
    # #!/bin/bash
    # echo your IP-Address is `/sbin/ifconfig ath0 | awk '/inet/ { print $2 }' | awk -F ":" '{ print # $2 }'`

    # E.O.F
    #=======================================================================================================================
    #=======================================================================================================================


    Ok, so what do you think? curious to see your files

    peace,
    Last edited by HackerzMaster; April 4th, 2007 at 11:50 AM.
    The second step on the way to become a hacker is to run GNU/Linux. (first step is to buy a computer)
    My old skewl http://www.skoz.nl/spelevaert/

  2. #2
    Just Another Geek
    Join Date
    Jul 2002
    Location
    Rotterdam, Netherlands
    Posts
    3,401
    Yours looks like OpenBSD.

    Here's my FreeBSD /etc/rc.conf:
    Code:
    hostname="MyComp.mydomain.home"
    ifconfig_rl0="DHCP"
    sendmail_enable="NO"
    sshd_enable="YES"
    syslogd_flags="-ss"
    Oliver's Law:
    Experience is something you don't get until just after you need it.

  3. #3
    nice, but is that your local initialization script? i mean the "special" tweakings.
    The second step on the way to become a hacker is to run GNU/Linux. (first step is to buy a computer)
    My old skewl http://www.skoz.nl/spelevaert/

  4. #4
    Just Another Geek
    Join Date
    Jul 2002
    Location
    Rotterdam, Netherlands
    Posts
    3,401
    There is no local initialization script on FreeBSD
    You can have one but in all those years I never had the need for one. With 5.0+ things got even better organized. Everything is controlled with variables in rc.conf. You want samba turned on? samba_enable="YES". Dhcpd? dhcpd_enable="YES". Firewall? pf_enable="YES".

    All base services start from /etc/rc.d/* and ports start from /usr/local/etc/rc.d/* . And everything can be turned on/off or given special flags[1] using variables in rc.conf. Makes it much less error-prone and it also allows you to easily start/stop single services[2].

    [1]
    dhcpd_flags="-q"
    dhcpd_ifaces="eth0"

    [2]
    /usr/local/etc/rc.d/isc-dhcpd start
    /usr/local/etc/rc.d/samba stop
    Last edited by SirDice; April 5th, 2007 at 08:10 PM.
    Oliver's Law:
    Experience is something you don't get until just after you need it.

  5. #5
    wow, i didn't even get the time to seriously try freebsd (although i promised )
    The second step on the way to become a hacker is to run GNU/Linux. (first step is to buy a computer)
    My old skewl http://www.skoz.nl/spelevaert/

  6. #6
    Just Another Geek
    Join Date
    Jul 2002
    Location
    Rotterdam, Netherlands
    Posts
    3,401
    Yours might look like:
    Code:
    hostname=mycomp.mydomain.home
    ifconfig_ath0="inet 192.168.0.1 netmask 255.255.255.0 ssid MYWIFI channel 6 mode 11g mediaopt hostap"
    ifconfig_eth0="DHCP"
    gateway_enable="YES"
    sshd_enable="YES"
    syslogd_flags="-ss"
    sendmail_enable="NO"  # this makes it run local-submit only
    dhcpd_enable="YES"
    dhcpd_ifaces="ath0"
    bthidd_enable="YES" # Bluetooth services
    Oliver's Law:
    Experience is something you don't get until just after you need it.

Similar Threads

  1. Writing to file in c++
    By Tedob1 in forum Other Tutorials Forum
    Replies: 4
    Last Post: October 15th, 2004, 06:31 AM
  2. Basic unix file and process commands
    By gizmofreak in forum Other Tutorials Forum
    Replies: 1
    Last Post: December 23rd, 2003, 05:51 AM
  3. Camouflage v1.2.1 The programme
    By Gbin@ryR in forum AntiOnline's General Chit Chat
    Replies: 8
    Last Post: February 28th, 2002, 05:52 PM
  4. Newbie Questions Answered - Chapter 4
    By uraloony in forum The Security Tutorials Forum
    Replies: 3
    Last Post: December 19th, 2001, 02:50 PM

Posting Permissions

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