How-To :: tunando a inicialização do Slackware


Aqui veremos as configurações usadas em meu Slack Current de modo a tornar sua inicialização e uso mais leve e rápida.

Este slideshow necessita de JavaScript.

Parte das modificações aqui publicadas foram obtidas a partir de pesquisa via internet, as fontes originais são as listadas abaixo:

Iniciando o Slackware em 12s ou menos

Turning off Services on Slackware

Com essa configuração atual o boot do Slackware ficou infinitamente mais rápido, não em 12s como numa das referências, atualmente da tela do LILO até o carregamento completo da sessão OpenBox: 35 segundos.

Esta dica é uma atualização de uma que postei a cerca de 2 anos, agora incrementada por um script de firewall configurado no site Easy Firewall Generator e algumas mudanças extras. Alguns serviços estão com a informação de desabilitados, mas às vezes fazem parte de outros scripts, caso do CUPS, WICD|NetWorkManager, já outros estão mesmo desabilitados porque não necessito dos mesmos ou então sequer estão instalados, caso do Apache, PHP, MySQL, BIND.

Os arquivos criados ou modificados foram os seguintes:

/etc/rc.d/rc.boottime

#!/bin/bash
#

#########################
# MORE INFO ABOUT CHANGES:
#
# http://allboutcomputer.wordpress.com/2012/07/16/turning-off-services-on-slackware/
# http://rra.etc.br/MyWorks/2011/10/28/iniciando-o-slackware-em-12s-ou-menos/
# https://edpsblog.wordpress.com/2015/04/06/how-to-tunando-a-inicializacao-do-slackware/
#
####################################################################################

STIME="/sys/module/printk/parameters/time"
BOOT_LOG="/root/BOOT_TIMES"

[ ! -e $BOOT_LOG ] && touch $BOOT_LOG

echo 1 > $STIME

echo "Boot time log message" > /dev/kmsg
tt=`dmesg | tail -1 | awk '{print $2}'`
echo 0 > $STIME
d=`date`
echo "Boot time: ${tt/]/}s (${d})" | tee -a $BOOT_LOG

Para o caso do log acerca do tempo de boot, o arquivo BOOT_TIMES será salvo na pasta /root, eis um exemplo de um log recente:

[4209:2864 0:118] 07:09:47 Ter Abr 07 [root@darkstar: +1] /home/edps 
(1:118)# cat /root/BOOT_TIMES 
Boot time: 19.481148s (Mon Apr  6 11:42:50 BRT 2015)
Boot time: 21.423077s (Mon Apr  6 20:53:07 BRT 2015)
Boot time: 24.947537s (Mon Apr  6 20:44:33 BRT 2015)
Boot time: 18.613913s (Mon Apr  6 21:01:55 BRT 2015)
Boot time: 32.652600s (Mon Apr  6 21:48:04 BRT 2015)
Boot time: 18.240826s (Tue Apr  7 00:41:26 BRT 2015)
Boot time: 18.986770s (Tue Apr  7 02:51:54 BRT 2015)
Boot time: 18.595259s (Tue Apr  7 14:55:26 BRT 2015)
Boot time: 18.080847s (Tue Apr  7 15:09:15 BRT 2015)
Boot time: 18.387791s (Tue Apr  7 15:16:56 BRT 2015)
Boot time: 18.247697s (Tue Apr  7 15:19:16 BRT 2015)
Boot time: 18.465056s (Tue Apr  7 15:26:15 BRT 2015)
Boot time: 18.532495s (Tue Apr  7 15:45:18 BRT 2015)
Boot time: 18.491805s (Tue Apr  7 15:51:21 BRT 2015)

[4209:2864 0:115] 07:09:53 Ter Abr 07 [root@darkstar: +1] /home/edps 
(1:115)# 

/etc/rc.d/rc.firewall

Caso queira gerar seu script de firewall, sugiro uma passada em:

Easy Firewall Generator for IPTables

Aqui, estou usando o script abaixo (com a interface de rede externa setada para eth0):

#!/bin/sh

#########################
# MORE INFO ABOUT CHANGES:
#
# http://allboutcomputer.wordpress.com/2012/07/16/turning-off-services-on-slackware/
# http://rra.etc.br/MyWorks/2011/10/28/iniciando-o-slackware-em-12s-ou-menos/
# https://edpsblog.wordpress.com/2015/04/06/how-to-tunando-a-inicializacao-do-slackware/
#
####################################################################################

IPT=$(which iptables)
EXT_IF=eth0

FIREWALL_CONF=/etc/iptables.conf

# Enable TCP SYN Cookie Protection.
if [ -e /proc/sys/net/ipv4/tcp_syncookies ]; then
  echo 1 > /proc/sys/net/ipv4/tcp_syncookies
fi

# Disable ICMP Redirect Acceptance.
echo 0 > /proc/sys/net/ipv4/conf/all/accept_redirects

# Do not send Redirect Messages.
echo 0 > /proc/sys/net/ipv4/conf/all/send_redirects

if [ -e $FIREWALL_CONF ]; then
  iptables-restore < $FIREWALL_CONF
  exit 0
fi

# Set default policy to DROP.
$IPT -P INPUT DROP
$IPT -P OUTPUT DROP
$IPT -P FORWARD DROP

# Flush old rules.
$IPT -F
$IPT -X

# Allow loopback traffic.
$IPT -A INPUT -i lo -j ACCEPT
$IPT -A OUTPUT -o lo -j ACCEPT

# Allow packets of established connections and those related to them.
$IPT -A INPUT -i $EXT_IF -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT

# Allow all outgoing packets except invalid ones.
$IPT -A OUTPUT -o $EXT_IF -m conntrack --ctstate INVALID -j DROP
$IPT -A OUTPUT -o $EXT_IF -j ACCEPT

# Uncomment (if you need) allow incoming ssh connections.
#$IPT -A INPUT -i $EXT_IF -p tcp --dport 22 --syn -m conntrack --ctstate NEW -j ACCEPT 

/etc/rc.d/rc.fsck_check

#!/bin/bash
#
# script rc.fsck_check
# by Rudson Alves
#

#########################
# MORE INFO ABOUT CHANGES:
#
# http://allboutcomputer.wordpress.com/2012/07/16/turning-off-services-on-slackware/
# http://rra.etc.br/MyWorks/2011/10/28/iniciando-o-slackware-em-12s-ou-menos/
# https://edpsblog.wordpress.com/2015/04/06/how-to-tunando-a-inicializacao-do-slackware/
#
####################################################################################

MAX_BOOT=20
rm /etc/fastboot 2>/dev/null

if [ -e /etc/fsck_check/count ]; then
  COUNT=`cat /etc/fsck_check/count`
else
  mkdir /etc/fsck_check 2>/dev/null
  echo $MAX_BOOT > /etc/fsck_check/count
  let COUNT=$MAX_BOOT+1
fi

let COUNT--

if [ $COUNT -lt 0 ]; then
  echo -e "e[31;1mFsck count -1: FSCK ONe[m"
  echo $MAX_BOOT > /etc/fsck_check/count
else
  echo -e "e[34;1mFsck count $COUNT: FAST BOOTe[m"
  echo $COUNT > /etc/fsck_check/count
  touch /etc/fastboot
fi

/etc/rc.d/rc.local_shutdown

#!/bin/bash
#
# script rc.local_shutdown
#

#########################
# MORE INFO ABOUT CHANGES:
#
# http://allboutcomputer.wordpress.com/2012/07/16/turning-off-services-on-slackware/
# http://rra.etc.br/MyWorks/2011/10/28/iniciando-o-slackware-em-12s-ou-menos/
# https://edpsblog.wordpress.com/2015/04/06/how-to-tunando-a-inicializacao-do-slackware/
#
####################################################################################

# Check fsck boot time
if [ -x /etc/rc.d/rc.fsck_check ]; then
  /etc/rc.d/rc.fsck_check
fi

/etc/rc.d/rc.netservices

#!/bin/sh
#
# rc.netservices
#

#########################
# MORE INFO ABOUT CHANGES:
#
# http://allboutcomputer.wordpress.com/2012/07/16/turning-off-services-on-slackware/
# http://rra.etc.br/MyWorks/2011/10/28/iniciando-o-slackware-em-12s-ou-menos/
# https://edpsblog.wordpress.com/2015/04/06/how-to-tunando-a-inicializacao-do-slackware/
#
####################################################################################

echo "Network services..."

#
### DESATIVADO ###
#### usar o default hostname "darkstar"
#
# Set the hostname.
#if [ -r /etc/HOSTNAME ]; then
#  /bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)
#else
#  # fall back on this old default:
#  echo "darkstar.example.net" > /etc/HOSTNAME
#  /bin/hostname darkstar
#fi

# Initialize the networking hardware.
if [ -x /etc/rc.d/rc.inet1 ]; then
  . /etc/rc.d/rc.inet1
fi

# Start networking daemons:
if [ -x /etc/rc.d/rc.inet2 ]; then
  . /etc/rc.d/rc.inet2
fi

###
### DESATIVADO ###
### já está habilitado em /etc/rc.d/rc.local.
###
# Start the Network Time Protocol daemon:
#if [ -x /etc/rc.d/rc.ntpd ]; then
#  sh /etc/rc.d/rc.ntpd start
#fi

###
### DESATIVADO ###
### já está habilitado em /etc/rc.d/rc.local.
###
# Start wicd:
#if [ -x /etc/rc.d/rc.wicd ]; then
#  sh /etc/rc.d/rc.wicd start
#fi

###
### DESATIVADO ###
###
# Start dnsmasq, a simple DHCP/DNS server:
#if [ -x /etc/rc.d/rc.dnsmasq ]; then
#  /etc/rc.d/rc.dnsmasq start
#fi

###
### DESATIVADO ###
###
# Start snmpd:
#if [ -x /etc/rc.d/rc.snmpd ]; then
#  /etc/rc.d/rc.snmpd start
#fi

###
### DESATIVADO ###
### já está habilitado em /etc/rc.d/rc.M
###
# Start the print spooling system.  This will usually be LPRng (lpd) or CUPS.
#if [ -x /etc/rc.d/rc.cups ]; then
  # Start CUPS:
#  /etc/rc.d/rc.cups start
#elif [ -x /etc/rc.d/rc.lprng ]; then
  # Start LPRng (lpd):
#  . /etc/rc.d/rc.lprng start
#fi

###
### DESATIVADO ###
###
# Start netatalk. (a file/print server for Macs using Appletalk)
#if [ -x /etc/rc.d/rc.atalk ]; then
#  /etc/rc.d/rc.atalk
#fi

###
### DESATIVADO ###
###
# Start the SASL authentication server.  This provides SASL
# authentication services for sendmail:
#if [ -x /etc/rc.d/rc.saslauthd ]; then
#  . /etc/rc.d/rc.saslauthd start
#fi

###
### DESATIVADO ###
###
# Start the sendmail daemon:
#if [ -x /etc/rc.d/rc.sendmail ]; then
#  . /etc/rc.d/rc.sendmail start
#fi

###
### DESATIVADO ###
###
# Start the MySQL database:
#if [ -x /etc/rc.d/rc.mysqld ]; then
#  . /etc/rc.d/rc.mysqld start
#fi

###
### DESATIVADO ###
###
# Start Apache web server:
#if [ -x /etc/rc.d/rc.httpd ]; then
#  . /etc/rc.d/rc.httpd start
#fi

###
### DESATIVADO ###
###
# Start OpenLDAP:
#if [ -x /etc/rc.d/rc.openldap ]; then
#  . /etc/rc.d/rc.openldap start
#fi

###
### DESATIVADO ###
###
# Start Samba (a file/print server for Win95/NT machines).
# Samba can be started in /etc/inetd.conf instead.
#if [ -x /etc/rc.d/rc.samba ]; then
#  . /etc/rc.d/rc.samba start
#fi

# All done.

/etc/rc.d/rc.update

#!/bin/bash
#
# This script executes boot commands if new packages are installed on the
# system.
#
# The checking is done by reading the modification date in the directory
# /var/log/packages
#
# by Rudson R. Alves
# version 2.0
#

#########################
# MORE INFO ABOUT CHANGES:
#
# http://allboutcomputer.wordpress.com/2012/07/16/turning-off-services-on-slackware/
# http://rra.etc.br/MyWorks/2011/10/28/iniciando-o-slackware-em-12s-ou-menos/
# https://edpsblog.wordpress.com/2015/04/06/how-to-tunando-a-inicializacao-do-slackware/
#
####################################################################################

UPDATE_DIR="/etc/update_cache"
PKGS_DIR="/var/log/packages"
UPDATE="off"

function get_date() {
  ls -la /var/log/ | awk '/ packages/ {print $5 $6 $7 $8}'
}

function update_cache() {
  echo -e "e[33;1m"
  # Update all the shared library links:
  if [ -x /sbin/ldconfig ]; then
    echo "Updating shared library links:  /sbin/ldconfig"
    /sbin/ldconfig &
  fi

  # Update the X font indexes:
  if [ -x /usr/bin/fc-cache ]; then
    echo "Updating X font indexes:  /usr/bin/fc-cache -f"
    /usr/bin/fc-cache -f &
  fi

  # Update any existing icon cache files:
  if find /usr/share/icons 2> /dev/null | grep -q icon-theme.cache ; then
    for theme_dir in /usr/share/icons/* ; do
      if [ -r ${theme_dir}/icon-theme.cache ]; then
        echo "Updating icon-theme.cache in ${theme_dir}..."
        /usr/bin/gtk-update-icon-cache -t -f ${theme_dir} 1> /dev/null 2> /dev/null
      fi
    done
    # This would be a large file and probably shouldn't be there.
    if [ -r /usr/share/icons/icon-theme.cache ]; then
      echo "Deleting icon-theme.cache in /usr/share/icons..."
      #/usr/bin/gtk-update-icon-cache -t -f /usr/share/icons 1> /dev/null 2> /dev/null
      rm -f /usr/share/icons/icon-theme.cache
    fi
  fi

  # Update mime database:
  if [ -x /usr/bin/update-mime-database -a -d /usr/share/mime ]; then
    echo "Updating MIME database:  /usr/bin/update-mime-database /usr/share/mime"
    /usr/bin/update-mime-database /usr/share/mime 1> /dev/null 2> /dev/null
  fi

  # These GTK+/pango files need to be kept up to date for
  # proper input method, pixbuf loaders, and font support.
  if [ -x /usr/bin/update-gtk-immodules ]; then
    /usr/bin/update-gtk-immodules --verbose
  fi
  if [ -x /usr/bin/update-gdk-pixbuf-loaders ]; then
    /usr/bin/update-gdk-pixbuf-loaders --verbose
  fi
  if [ -x /usr/bin/update-pango-querymodules ]; then
    /usr/bin/update-pango-querymodules --verbose
  fi
  echo -e "e[m"

}

# -------------------------------------------
#                  Script
# -------------------------------------------
#
echo -en "Check $PKGS_DIR for new packages... "

# check if exist date file UPDATE_DIR
if [ ! -e $UPDATE_DIR/date ]; then
  mkdir $UPDATE_DIR 2>/dev/null
  NEW_DATE=`get_date`
  echo $NEW_DATE > $UPDATE_DIR/date
  UPDATE="on"
fi

OLD_DATE=`cat $UPDATE_DIR/date`

# if UPDATE off, create get new date to check
if [ "$UPDATE" == "off" ]; then
  NEW_DATE=`get_date`
  # check modification date
  if [ "$OLD_DATE" != "$NEW_DATE" ]; then
    UPDATE="on"
  fi
fi

if [ "$UPDATE" == "on" ]; then
  echo -e "e[34;1m        [ Update caches... ]e[m"
  update_cache
  echo $NEW_DATE > $UPDATE_DIR/date
else
  echo -e "e[32;1m        [ Skip ]e[m"
fi

Importante.

Nos scripts a seguir: /etc/rc.d/rc.M, /etc/rc.d/rc.inet1, /etc/rc.d/rc.inet2 e /etc/rc.d/rc.local foram inseridos comentários informando o que foi modificado e/ou desativado.

O script /etc/rc.d/rc.M trata de subir os serviços no modo-multiusuário, então caso esteja usando o runlevel 3 (modo texto) ignore-o.

Já o script /etc/rc.d/rc.inet2 trata de subir os serviços de rede em conjunto com o /etc/rc.d/rc.inet1, que trata de ativar a interface de rede, com as mudanças ambos são chamados pelo script /etc/rc.d/rc.netservices, visto lá no início.

Por sua vez, o script /etc/rc.d/rc.local nos permite executar comandos antes da inicialização do ambiente gráfico, o do exemplo tem 3 funções, chamar o script /etc/rc.d/rc.update visto lá no início, iniciar o WICD já que desabilitei o DHCP e atualizar a hora visto que desabilitei o NTP.

Maiores detalhes acerca dos runlevels, scripts de inicialização, etc, do Slackware podem ser vistos em:

http://www.slackware.com/config/init.php

/etc/rc.d/rc.inet1

Se não deseja usar o DHCP que atrasa consideravelmente o tempo de boot, altere a linha if [ “${USE_DHCP[$i]}” = “yes” ]; then para if [ “${USE_DHCP[$i]}” = “no” ]; then, no exemplo abaixo o DHCP já está desabilitado.

Se o desabilitou, certifique-se quie tenha alguém subindo suas interfaces de rede: network-manager, wicd, ambos instaláveis via slackpkg, aqui eu uso o wicd.

#! /bin/sh
# /etc/rc.d/rc.inet1
# This script is used to bring up the various network interfaces.
#
# @(#)/etc/rc.d/rc.inet1 10.2  Sun Jul 24 12:45:56 PDT 2005  (pjv)

#########################
# MORE INFO ABOUT CHANGES:
#
# http://allboutcomputer.wordpress.com/2012/07/16/turning-off-services-on-slackware/
# http://rra.etc.br/MyWorks/2011/10/28/iniciando-o-slackware-em-12s-ou-menos/
# https://edpsblog.wordpress.com/2015/04/06/how-to-tunando-a-inicializacao-do-slackware/
#
####################################################################################

############################
# READ NETWORK CONFIG FILE #
############################

# Get the configuration information from /etc/rc.d/rc.inet1.conf:
. /etc/rc.d/rc.inet1.conf

###########
# LOGGING #
###########

# If possible, log events in /var/log/messages:
if [ -f /var/run/syslogd.pid -a -x /usr/bin/logger ]; then
  LOGGER=/usr/bin/logger
else # output to stdout/stderr:
  LOGGER=/bin/cat
fi

############################
# DETERMINE INTERFACE LIST #
############################

# Compose a list of interfaces from /etc/rc.d/rc.inet1.conf (with a maximum
# of 6 interfaces, but you can easily enlarge the interface limit
# - send me a picture of such a box :-).
# If a value for IFNAME[n] is not set, we assume it is an eth'n' interface.
# This way, the new script is compatible with older rc.inet1.conf files.
# The IFNAME array will be used to determine which interfaces to bring up/down.
MAXNICS=${MAXNICS:-6}
i=0
while [ $i -lt $MAXNICS ];
do
  IFNAME[$i]=${IFNAME[$i]:=eth${i}}
  i=$(($i+1))
done
if [ "$DEBUG_ETH_UP" = "yes" ]; then
  echo "/etc/rc.d/rc.inet1:  List of interfaces: '${IFNAME[@]}'" | $LOGGER
fi

######################
# LOOPBACK FUNCTIONS #
######################

# Function to bring up the loopback interface.  If loopback is
# already up, do nothing.
lo_up() {
  if grep lo: /proc/net/dev 1> /dev/null ; then
    if ! /sbin/ifconfig | grep "^lo" 1> /dev/null ; then
      echo "/etc/rc.d/rc.inet1:  /sbin/ifconfig lo 127.0.0.1" | $LOGGER
      /sbin/ifconfig lo 127.0.0.1
      echo "/etc/rc.d/rc.inet1:  /sbin/route add -net 127.0.0.0 netmask 255.0.0.0 lo" | $LOGGER
      /sbin/route add -net 127.0.0.0 netmask 255.0.0.0 lo
    fi
  fi
}

# Function to take down the loopback interface:
lo_down() {
  if grep lo: /proc/net/dev 1> /dev/null ; then
    echo "/etc/rc.d/rc.inet1:  /sbin/ifconfig lo down" | $LOGGER
    /sbin/ifconfig lo down
  fi
}

#######################
# INTERFACE FUNCTIONS #
#######################

# Function to assemble a bridge interface.
br_open() {
  # argument is 'i' - the position of this interface in the IFNAME array.
  /sbin/brctl addbr ${IFNAME[$1]}
  for BRIF in $(echo ${BRNICS[$1]}); do
    /sbin/ifconfig $BRIF down
    /sbin/ifconfig $BRIF 0.0.0.0 promisc up
    /sbin/brctl addif ${IFNAME[$1]} $BRIF
  done
}

# Function to disassemble a bridge interface.
br_close() {
  # argument is 'i' - the position of this interface in the IFNAME array.
  #for BRIF in $(echo ${BRNICS[$1]}); do
  for BRIF in $(ls --indicator-style=none /sys/class/net/${IFNAME[$1]}/brif/)
  do
    /sbin/brctl delif ${IFNAME[$1]} $BRIF
  done
  /sbin/ifconfig ${IFNAME[$1]} down
  /sbin/brctl delbr ${IFNAME[$1]}
}

# Function to bring up a network interface.  If the interface is
# already up or does not yet exist (perhaps because the kernel driver
# is not loaded yet), do nothing.
if_up() {
  # Determine position 'i' of this interface in the IFNAME array:
  i=0
  while [ $i -lt $MAXNICS ]; do
    [ "${IFNAME[$i]}" = "${1}" ] && break
    i=$(($i+1))
  done
  # If the interface is a bridge, then create it first:
  [ -n "${BRNICS[$i]}" ] && br_open $i
  # If the interface isn't in the kernel yet (but there's an alias for it in
  # modules.conf), then it should be loaded first:
  if ! grep `echo ${1}: | cut -f 1 -d :`: /proc/net/dev 1> /dev/null ; then # no interface yet
    if /sbin/modprobe -c | grep -v "^#" | grep -w "alias ${1}" | grep -vw "alias ${1} off" > /dev/null ; then
      echo "/etc/rc.d/rc.inet1:  /sbin/modprobe ${1}" | $LOGGER
      /sbin/modprobe ${1}
    fi
  fi
  if grep `echo ${1}: | cut -f 1 -d :`: /proc/net/dev 1> /dev/null ; then # interface exists
    if ! /sbin/ifconfig | grep -w "${1}" 1>/dev/null || \
      ! /sbin/ifconfig ${1} | grep -w inet 1> /dev/null ; then # interface not up or not configured
      if [ ! "${HWADDR[$i]}" = "" ]; then # Set hardware address _before_ the interface goes up:
        echo "/etc/rc.d/rc.inet1:  /sbin/ifconfig ${1} hw ether ${HWADDR[$i]}" | $LOGGER
        /sbin/ifconfig ${1} hw ether ${HWADDR[$i]}
      fi
      if [ ! "${MTU[$i]}" = "" ]; then # Set MTU to something else than 1500
        echo "/etc/rc.d/rc.inet1:  /sbin/ifconfig ${1} mtu ${MTU[$i]}" | $LOGGER
        /sbin/ifconfig ${1} mtu ${MTU[$i]}
      fi
      if [ -x /etc/rc.d/rc.wireless ]; then
        . /etc/rc.d/rc.wireless ${1} start # Initialize any wireless parameters
      fi
#####
##### CASO QUEIRA HABILITAR O DHCP, ALTERE A LINHA ABAIXO!!! 
#####
      if [ "${USE_DHCP[$i]}" = "no" ]; then # use DHCP to bring interface up
        # Clear DHCP_OPTIONS before adding new options to it:
        unset DHCP_OPTIONS
        # Set DHCP_OPTIONS for this interface:
        [ ${DHCP_HOSTNAME[$i]} ] && DHCP_OPTIONS="-h ${DHCP_HOSTNAME[$i]}"
        [ "${DHCP_KEEPRESOLV[$i]}" = "yes" ] && DHCP_OPTIONS="$DHCP_OPTIONS -C resolv.conf"
        [ "${DHCP_KEEPNTP[$i]}" = "yes" ] && DHCP_OPTIONS="$DHCP_OPTIONS -C ntp.conf"
        [ "${DHCP_KEEPGW[$i]}" = "yes" ] && DHCP_OPTIONS="$DHCP_OPTIONS -G"
        [ "${DHCP_DEBUG[$i]}" = "yes" ] && DHCP_OPTIONS="$DHCP_OPTIONS -d"
        [ "${DHCP_NOIPV4LL[$i]}" = "yes" ] && DHCP_OPTIONS="$DHCP_OPTIONS -L"
        [ ${DHCP_IPADDR[$i]} ] && DHCP_OPTIONS="$DHCP_OPTIONS -r ${DHCP_IPADDR[$i]}"
        echo "Polling for DHCP server on interface ${1}:"
        # If you set a timeout, you get one, even if the kernel doesn't think that
        # your device is connected, in case /sys isn't right (which it usually isn't
        # except right after the device is loaded, when it usually is):
        #### (start commented out)
        # This is deactivated for now since the kernel has been returning incorrect
        # results concerning whether the interface carrier is detected.
        #if [ "${DHCP_TIMEOUT[$i]}" = "" ]; then
        #  ifconfig ${1} up && sleep 1
        #  CONNSTATUS="$(cat /sys/class/net/${1}/carrier 2> /dev/null)"
        #  ifconfig ${1} down
        #  if [ "$CONNSTATUS" = "0" ]; then
        #    # The kernel has just told us the cable isn't even plugged in, but we will
        #    # give any DHCP server a short chance to reply anyway:
        #    echo "No carrier detected on ${1}.  Reducing DHCP timeout to 10 seconds."
        #    DHCP_TIMEOUT[$i]=10
        #  fi
        #fi
        #### (end commented out)
        # 10 seconds should be a reasonable default DHCP timeout.  30 was too much.
        echo "/etc/rc.d/rc.inet1:  /sbin/dhcpcd -t ${DHCP_TIMEOUT[$i]:-10} ${DHCP_OPTIONS} ${1}" | $LOGGER
        /sbin/dhcpcd -t ${DHCP_TIMEOUT[$i]:-10} ${DHCP_OPTIONS} ${1}
      else # bring up interface using a static IP address
        if [ ! "${IPADDR[$i]}" = "" ]; then # skip unconfigured interfaces
          # Determine broadcast address from the IP address and netmask:
          BROADCAST[$i]=`/bin/ipmask ${NETMASK[$i]} ${IPADDR[$i]}|cut -f1 -d' '`
          # Set up the network card:
          echo "/etc/rc.d/rc.inet1:  /sbin/ifconfig ${1} ${IPADDR[$i]} broadcast ${BROADCAST[$i]} netmask ${NETMASK[$i]}" | $LOGGER
          /sbin/ifconfig ${1} ${IPADDR[$i]} broadcast ${BROADCAST[$i]} netmask ${NETMASK[$i]}
        else
          if [ "$DEBUG_ETH_UP" = "yes" ]; then
            echo "/etc/rc.d/rc.inet1:  ${1} interface is not configured in /etc/rc.d/rc.inet1.conf" | $LOGGER
          fi
        fi
      fi
    else
      if [ "$DEBUG_ETH_UP" = "yes" ]; then
        echo "/etc/rc.d/rc.inet1:  ${1} is already up, skipping" | $LOGGER
      fi
    fi 
  else
    if [ "$DEBUG_ETH_UP" = "yes" ]; then
      echo "/etc/rc.d/rc.inet1:  ${1} interface does not exist (yet)" | $LOGGER
    fi
  fi
}

# Function to take down a network interface:
if_down() {
  # Determine position 'i' of this interface in the IFNAME array:
  i=0
  while [ $i -lt $MAXNICS ]; do
    [ "${IFNAME[$i]}" = "${1}" ] && break
    i=$(($i+1))
  done
  if grep `echo ${1}: | cut -f 1 -d :`: /proc/net/dev 1> /dev/null ; then
    if [ "${USE_DHCP[$i]}" = "yes" ]; then
      echo "/etc/rc.d/rc.inet1:  /sbin/dhcpcd -k -d ${1}" | $LOGGER
      /sbin/dhcpcd -k -d ${1} 2> /dev/null || /sbin/ifconfig ${1} down
      sleep 1
    else
      echo "/etc/rc.d/rc.inet1:  /sbin/ifconfig ${1} down" | $LOGGER
      /sbin/ifconfig ${1} down
    fi
    if [ -x /etc/rc.d/rc.wireless ]; then
      . /etc/rc.d/rc.wireless ${1} stop # Kill wireless daemons if any.
    fi
    # If the interface is a bridge, then destroy it now:
    [ -n "${BRNICS[$i]}" ] && br_close $i
  fi
}

#####################
# GATEWAY FUNCTIONS #
#####################

# Function to bring up the gateway if there is not yet a default route:
gateway_up() {
  if ! /sbin/route -n | grep "^0.0.0.0" 1> /dev/null ; then
    if [ ! "$GATEWAY" = "" ]; then
      echo "/etc/rc.d/rc.inet1:  /sbin/route add default gw ${GATEWAY} metric 1" | $LOGGER
      /sbin/route add default gw ${GATEWAY} metric 1 2>&1 | $LOGGER
    fi
  fi
}

# Function to take down an existing default gateway:
gateway_down() {
  if /sbin/route -n | grep "^0.0.0.0" 1> /dev/null ; then
    echo "/etc/rc.d/rc.inet1:  /sbin/route del default" | $LOGGER
    /sbin/route del default
  fi
}

# Function to start the network:
start() {
  lo_up
  for i in ${IFNAME[@]} ; do
    if_up $i
  done
  gateway_up
}

# Function to stop the network:
stop() {
  gateway_down
  for i in ${IFNAME[@]} ; do
    if_down $i
  done
  lo_down
}


############
### MAIN ###
############

case "$1" in
'start') # "start" brings up all configured interfaces:
  start
  ;;
'stop') # "stop" takes down all configured interfaces:
  stop
  ;;
'restart') # "restart" restarts the network:
  stop
  start
  ;;
*_start) # Example: "eth1_start" will start the specified interface 'eth1'
  INTERFACE=`echo $1 | /bin/cut -d '_' -f 1`
  if_up $INTERFACE
  gateway_up
  ;;
*_stop) # Example: "eth0_stop" will stop the specified interface 'eth0'
  INTERFACE=`echo $1 | /bin/cut -d '_' -f 1`
  if_down $INTERFACE
  ;;
*_restart) # Example: "wlan0_restart" will take 'wlan0' down and up again
  INTERFACE=`echo $1 | /bin/cut -d '_' -f 1`
  if_down $INTERFACE
  sleep 1
  if_up $INTERFACE
  gateway_up
  ;;
'up') # "up" does the same thing as "start"
  start
  ;;
'down') # "down" does the same thing as "stop"
  stop
  ;;
*_up) # "*_up" does the same thing as "*_start"
  INTERFACE=`echo $1 | /bin/cut -d '_' -f 1`
  if_up $INTERFACE
  gateway_up
  ;;
*_down) # "*_down" does the same thing as "*_stop"
  INTERFACE=`echo $1 | /bin/cut -d '_' -f 1`
  if_down $INTERFACE
  ;;
*) # The default is to bring up all configured interfaces:
  start
esac

# End of /etc/rc.d/rc.inet1

/etc/rc.d/rc.inet2

#!/bin/sh
#
# rc.inet2	This shell script boots up the entire network system.
#		Note, that when this script is used to also fire
#		up any important remote NFS disks (like the /usr
#		directory), care must be taken to actually
#		have all the needed binaries online _now_ ...
#
#               Uncomment or comment out sections depending on which
#               services your site requires.
#
# Author:	Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
# Modified for Slackware by Patrick Volkerding <volkerdi@slackware.com>

# At this point, we are ready to talk to The World...

#########################
# MORE INFO ABOUT CHANGES:
#
# http://allboutcomputer.wordpress.com/2012/07/16/turning-off-services-on-slackware/
# http://rra.etc.br/MyWorks/2011/10/28/iniciando-o-slackware-em-12s-ou-menos/
# https://edpsblog.wordpress.com/2015/04/06/how-to-tunando-a-inicializacao-do-slackware/
#
####################################################################################

###
### DESATIVADO ###
###
# Mount remote (NFS) filesystems:
#if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then
  # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS
  # volumes defined in /etc/fstab since these will need to be running in order
  # to mount them.  If they are not running, attempting to mount an NFS
  # partition will cause mount to hang, or at least result in unreliable
  # operation.  Keep this in mind if you plan to mount unlisted NFS
  # partitions... 
  # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run
  # whether it is set as executable or not.  If you don't want to run it,
  # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.
#  if [ -r /etc/rc.d/rc.rpc ]; then
#    sh /etc/rc.d/rc.rpc start
#  fi
#  echo "Mounting remote (NFS) file systems:  /sbin/mount -a -t nfs"
#  /sbin/mount -a -t nfs          # This may be our /usr runtime!
  # Show the mounted volumes:
#  /sbin/mount -v -t nfs
#fi

###
### DESATIVADO ###
###
# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,
# and rpc.statd.  This might be needed to mount NFS partitions that are not
# listed in /etc/fstab.  Starting this twice won't hurt as the script will
# check if things are already running before trying to start them.
#if [ -x /etc/rc.d/rc.rpc ]; then
#  sh /etc/rc.d/rc.rpc start
#fi

###
### DESATIVADO ###
###
# Mount remote CIFS filesystems.  Note that where possible, using CIFS is
# preferred over SMBFS.  SMBFS is no longer actively maintained.
#if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then
#  echo "Mounting remote CIFS file systems:  /sbin/mount -a -t cifs"
#  /sbin/mount -a -t cifs
  # Show the mounted volumes:
#  /sbin/mount -v -t cifs
#fi

###
### DESATIVADO ###
###
# Mount remote SMB filesystems:
#if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then
#  echo "Mounting remote SMBFS file systems:  /sbin/mount -a -t smbfs"
#  /sbin/mount -a -t smbfs
  # Show the mounted volumes:
#  /sbin/mount -v -t smbfs
#fi

# Start the system logger if it is not already running (maybe because /usr
# is on a network partition).
if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then
  . /etc/rc.d/rc.syslog start
fi

###
### HABILITA aquele script de firewall visto no começo do artigo.
###
# If there is a firewall script, run it before enabling packet forwarding.
# See the HOWTOs on http://www.netfilter.org/ for documentation on
# setting up a firewall or NAT on Linux.  In some cases this might need to
# be moved past the section below dealing with IP packet forwarding.
if [ -x /etc/rc.d/rc.firewall ]; then
  /etc/rc.d/rc.firewall start
fi

###
### DESATIVADO ###
###
# Turn on IPv4 packet forwarding support.
if [ -x /etc/rc.d/rc.ip_forward ]; then
  . /etc/rc.d/rc.ip_forward start
fi

# Start the inetd server:
if [ -x /etc/rc.d/rc.inetd ]; then
  /etc/rc.d/rc.inetd start
fi

###
### DESATIVADO ###
###
# Start the OpenSSH SSH daemon:
#if [ -x /etc/rc.d/rc.sshd ]; then
#  echo "Starting OpenSSH SSH daemon:  /usr/sbin/sshd"
#  /etc/rc.d/rc.sshd start
#fi

###
### DESATIVADO ###
###
# Start the BIND name server daemon:
#if [ -x /etc/rc.d/rc.bind ]; then
#  /etc/rc.d/rc.bind start
#fi

###
### DESATIVADO ###
###
# Start NIS (the Network Information Service):
#if [ -x /etc/rc.d/rc.yp ]; then
#  /etc/rc.d/rc.yp start
#fi

###
### DESATIVADO ###
###
# Start the NFS server.  Note that for this to work correctly, you'll
# need nfsd support in the kernel (the startup script will try to load
# the module for you).
# You'll also need to set up some shares in /etc/exports.
# Starting the NFS server:
#if [ -x /etc/rc.d/rc.nfsd ]; then
#  /etc/rc.d/rc.nfsd start
#fi

# Stuff you won't need follows.  😉

# # Start the network routing daemon:
# if [ -x /usr/sbin/routed ]; then
#   echo "Starting network routing daemon:  /usr/sbin/routed"
#   /usr/sbin/routed -g -s
# fi

# # Start the system status server:
# if [ -x /usr/sbin/rwhod ]; then
#   echo "Starting system status server:  /usr/sbin/rwhod"
#   /usr/sbin/rwhod
# fi

#  # Fire up the PC-NFS daemon(s).  This is a primarily obsolete system, and may
#  # not be very secure.  It's not at all needed for normal NFS server support.
#  # You probably should not run this.
#  if [ -x /usr/sbin/rpc.pcnfsd ]; then
#    echo "Starting PC-NFS daemons:  /usr/sbin/rpc.pcnfsd /usr/sbin/rpc.bwnfsd"
#    /usr/sbin/rpc.pcnfsd /var/spool/lpd
#  fi
#  if [ -x /usr/sbin/rpc.bwnfsd ]; then
#    /usr/sbin/rpc.bwnfsd /var/spool/lpd
#  fi

/etc/rc.d/rc.M

#!/bin/sh
#
# rc.M		This file is executed by init(8) when the system is being
#		initialized for one of the "multi user" run levels (i.e.
#		levels 1 through 6).  It usually does mounting of file
#		systems et al.
#
# Version:	@(#)/etc/rc.d/rc.M	2.23	Wed Feb 26 19:20:58 PST 2003
#
# Author:	Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
#		Heavily modified by Patrick Volkerding <volkerdi@slackware.com>
#

#########################
# MORE INFO ABOUT CHANGES:
#
# http://allboutcomputer.wordpress.com/2012/07/16/turning-off-services-on-slackware/
# http://rra.etc.br/MyWorks/2011/10/28/iniciando-o-slackware-em-12s-ou-menos/
# https://edpsblog.wordpress.com/2015/04/06/how-to-tunando-a-inicializacao-do-slackware/
#
####################################################################################

# Tell the viewers what's going to happen.
echo "Going multiuser..."

# Update all the shared library links:
if [ -x /sbin/ldconfig ]; then
  echo "Updating shared library links:  /sbin/ldconfig &"
  /sbin/ldconfig &
fi

###
### DESATIVADO ###
###
### Em Notebooks e afins deixe-o habilitado.
###
# Screen blanks after 15 minutes idle time, and powers down in one hour
# if the kernel supports APM or ACPI power management:
#/bin/setterm -blank 15 -powersave powerdown -powerdown 60

###
### DESATIVADO, usar o default hostname "darkstar" ###
###
# Set the hostname.
#if [ -r /etc/HOSTNAME ]; then
#  /bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)
#else
  # fall back on this old default:
#  echo "darkstar.example.net" > /etc/HOSTNAME
#  /bin/hostname darkstar
#fi

# Set the permissions on /var/log/dmesg according to whether the kernel
# permits non-root users to access kernel dmesg information:
if [ -r /proc/sys/kernel/dmesg_restrict ]; then
  if [ $(cat /proc/sys/kernel/dmesg_restrict) = 1 ]; then
    touch /var/log/dmesg
    chmod 640 /var/log/dmesg
  fi
else
  touch /var/log/dmesg
  chmod 644 /var/log/dmesg
fi
# Save the contents of 'dmesg':
/bin/dmesg -s 65536 > /var/log/dmesg

###
### DESATIVADO ###
###
# Initialize PCMCIA devices:
#
# NOTE: This used to be started near the top of rc.S so that PCMCIA devices
# could be fsck'ed along with the other drives.  This had some unfortunate
# side effects, however, since root isn't yet read-write, and /var might not
# even be mounted the .pid files can't be correctly written in /var/run and
# the pcmcia system can't be correctly shut down.  If you want some PCMCIA
# partition to be mounted at boot (or when the card is inserted) then add
# the appropriate lines to /etc/pcmcia/scsi.opts.
#
# Note that the stuff in /etc/pcmcia/ is only for 2.4.x kernels using
# 16-bit PCMCIA cards (not 32-bit Cardbus cards!).  For example, with a
# wireless card you might need to set options in /etc/pcmcia OR in
# /etc/rc.d/rc.wireless.conf, or even in /etc/rc.d/rc.inet1.conf (with
# extra options if needed for the encryption key, ESSID, etc.)
#
# Hopefully this situation will be unified in the future, but for now
# that's how it is...
#
#if [ -x /etc/rc.d/rc.pcmcia ]; then
#  . /etc/rc.d/rc.pcmcia start
#  # The cards might need a little extra time here to initialize.
#  sleep 5
#fi

# Start the system logger.
if [ -x /etc/rc.d/rc.syslog -a -x /usr/sbin/syslogd -a -d /var/log ]; then
  . /etc/rc.d/rc.syslog start
fi

###
### DESATIVADO, já está no script /etc/rc.d/rc.update ###
###
# Update the X font indexes:
#if [ -x /usr/bin/fc-cache ]; then
#  echo "Updating X font indexes:  /usr/bin/fc-cache -f &"
#  /usr/bin/fc-cache -f &
#fi

# Run rc.udev again.  This will start udev if it is not already running
# (for example, upon return from runlevel 1), otherwise it will trigger it
# to look for device changes and to generate persistent rules if needed.
if grep -wq sysfs /proc/mounts && grep -q devtmpfs /proc/filesystems ; then
  if ! grep -wq nohotplug /proc/cmdline ; then
    if [ -x /etc/rc.d/rc.udev ]; then
      /bin/sh /etc/rc.d/rc.udev start
    fi
  fi
fi

###
### DESATIVADO, já está no script /etc/rc.d/rc.netservices. ###
###
# Initialize the networking hardware.
#if [ -x /etc/rc.d/rc.inet1 ]; then
#  . /etc/rc.d/rc.inet1
#fi

# Look for additional USB/SCSI/IEEE1394/etc devices on multiple LUNs:
if [ -x /etc/rc.d/rc.scanluns ]; then
  . /etc/rc.d/rc.scanluns
fi

###
### DESATIVADO, já está no script /etc/rc.d/rc.netservices. ###
###
# Start networking daemons:
#if [ -x /etc/rc.d/rc.inet2 ]; then
#  . /etc/rc.d/rc.inet2
#fi

# Mount any additional filesystem types that haven't already been mounted:
mount -a -v 2> /dev/null | grep -v -e "already mounted" -e "ignored" | cut -f 1 -d : | tr -d ' ' | while read dev ; do mount | grep "${dev} " ; done

# Start the Control Script for automounter:
if [ -x /etc/rc.d/rc.autofs ]; then
  sh /etc/rc.d/rc.autofs start
fi

### 
### DESATIVADO, atualização manual da hora no script /etc/rc.d/rc.local. ###
###
# Start the Network Time Protocol daemon:
#if [ -x /etc/rc.d/rc.ntpd ]; then
#  sh /etc/rc.d/rc.ntpd start
#fi

# Remove stale locks and junk files (must be done after mount -a!)
/bin/rm -f /var/lock/* /var/spool/uucp/LCK..* /tmp/.X*lock /tmp/core /core 2> /dev/null
/bin/rm -rf /var/spool/cron/cron.?????? 2> /dev/null

# Remove stale hunt sockets so the game can start.
if [ -r /tmp/hunt -o -r /tmp/hunt.stats ]; then
  echo "Removing your stale hunt sockets from /tmp."
  /bin/rm -f /tmp/hunt*
fi

# Ensure basic filesystem permissions sanity.
chmod 755 / 2> /dev/null
chmod 1777 /tmp /var/tmp

###
### DESATIVADO ###
###
### Em Notebooks e afins deixe-o habilitado.
###
# Start APM or ACPI daemon.
# If APM is enabled in the kernel, start apmd:
#if [ -e /proc/apm ]; then
#  if [ -x /usr/sbin/apmd ]; then
#    echo "Starting APM daemon:  /usr/sbin/apmd"
#    /usr/sbin/apmd
#  fi
#elif [ -x /etc/rc.d/rc.acpid ]; then # otherwise, start acpid:
#  . /etc/rc.d/rc.acpid start
#fi

###
### DESATIVADO, já está no script /etc/rc.d/rc.update ###
###
# Update any existing icon cache files:
#if find /usr/share/icons -maxdepth 2 2> /dev/null | grep -q icon-theme.cache ; then
#  for theme_dir in /usr/share/icons/* ; do
#    if [ -r ${theme_dir}/icon-theme.cache ]; then
#      echo "Updating icon-theme.cache in ${theme_dir}..."
#      /usr/bin/gtk-update-icon-cache -t -f ${theme_dir} 1> /dev/null 2> /dev/null &
#    fi
#  done
#  # This would be a large file and probably shouldn't be there.
#  if [ -r /usr/share/icons/icon-theme.cache ]; then
#    echo "Deleting icon-theme.cache in /usr/share/icons..."
#    #/usr/bin/gtk-update-icon-cache -t -f /usr/share/icons 1> /dev/null 2> /dev/null &
#    rm -f /usr/share/icons/icon-theme.cache
#  fi
#fi

###
### DESATIVADO, já está no script /etc/rc.d/rc.update ###
###
# Update mime database:
#if [ -x /usr/bin/update-mime-database -a -d /usr/share/mime ]; then
#  echo "Updating MIME database:  /usr/bin/update-mime-database /usr/share/mime &"
#  /usr/bin/update-mime-database /usr/share/mime 1> /dev/null 2> /dev/null &
#fi

# Start D-Bus:
if [ -x /etc/rc.d/rc.messagebus ]; then
  sh /etc/rc.d/rc.messagebus start
fi

# Start console-kit-daemon:
if [ -x /etc/rc.d/rc.consolekit ]; then
  sh /etc/rc.d/rc.consolekit start
fi

#
### MODIFICADO (adicionado o & ao final) ###
#
# Start HAL:
if [ -x /etc/rc.d/rc.hald ]; then
  sh /etc/rc.d/rc.hald start &
fi

###
### ADICIONADO, neste script substitui os scripts rc.inet1 e rc.inet1  ###
###
# Initialize the networking hardware.
if [ -x /etc/rc.d/rc.netservices ]; then
  . /etc/rc.d/rc.netservices 2>&1 > /var/log/rc.netservices &
fi

###
### DESATIVADO, (deixe-o habilitado se usar Notebooks e etc) ###
###
# Start Bluetooth:
#if [ -x /etc/rc.d/rc.bluetooth ]; then
#  sh /etc/rc.d/rc.bluetooth start
#fi

###
### DESATIVADO (já habilitado em /etc/rc.d/rc.local) ###
### 
# Start wicd or networkmanager:
#if [ -x /etc/rc.d/rc.wicd -a -x /usr/sbin/wicd ]; then
#  sh /etc/rc.d/rc.wicd start
#elif [ -x /etc/rc.d/rc.networkmanager ]; then
#  sh /etc/rc.d/rc.networkmanager start
#fi

###
### DESATIVADO (já habilitado em /etc/rc.d/rc.update) ###
### 
# These GTK+/pango files need to be kept up to date for
# proper input method, pixbuf loaders, and font support.
#if [ -x /usr/bin/update-gtk-immodules ]; then
#  echo "Updating gtk.immodules:"
#  echo "  /usr/bin/update-gtk-immodules &"
#  /usr/bin/update-gtk-immodules > /dev/null 2>&1 &
#fi
#if [ -x /usr/bin/update-gdk-pixbuf-loaders ]; then
#  echo "Updating gdk-pixbuf.loaders:"
#  echo "  /usr/bin/update-gdk-pixbuf-loaders &"
#  /usr/bin/update-gdk-pixbuf-loaders > /dev/null 2>&1 &
#fi
#if [ -x /usr/bin/update-pango-querymodules ]; then
#  echo "Updating pango.modules:"
#  echo "  /usr/bin/update-pango-querymodules &"
#  /usr/bin/update-pango-querymodules > /dev/null 2>&1 &
#fi
#if [ -x /usr/bin/glib-compile-schemas ]; then
#  echo "Compiling GSettings XML schema files:"
#  echo "  /usr/bin/glib-compile-schemas /usr/share/glib-2.0/schemas &"
#  /usr/bin/glib-compile-schemas /usr/share/glib-2.0/schemas >/dev/null 2>&1 &
#fi

###
### DESATIVADO ###
###
# Start dnsmasq, a simple DHCP/DNS server:
#if [ -x /etc/rc.d/rc.dnsmasq ]; then
#  /etc/rc.d/rc.dnsmasq start
#fi

###
### DESATIVADO ###
###
# Start snmpd:
#if [ -x /etc/rc.d/rc.snmpd ]; then
#  /etc/rc.d/rc.snmpd start
#fi

###
### HABILITADO ###
###
### Habilite apenas se necessitar de impressoras, cups-pdf, etc. ####
###
# Start the print spooling system.  This will usually be LPRng (lpd) or CUPS.
if [ -x /etc/rc.d/rc.cups ]; then
  # Start CUPS:
  /etc/rc.d/rc.cups start
elif [ -x /etc/rc.d/rc.lprng ]; then
#  # Start LPRng (lpd):
  . /etc/rc.d/rc.lprng start
fi

###
### DESATIVADO ###
###
# Start netatalk. (a file/print server for Macs using Appletalk)
#if [ -x /etc/rc.d/rc.atalk ]; then
#  /etc/rc.d/rc.atalk start
#fi

###
### DESATIVADO ###
###
### Habilite apenas se deseja monitorar o estado dos discos. ####
###
# Start smartd, which monitors the status of S.M.A.R.T. compatible
# hard drives and reports any problems.  Note some devices (which aren't
# smart, I guess 😉 will hang if probed by smartd, so it's commented out
# by default.
#if [ -x /usr/sbin/smartd ]; then
#  /usr/sbin/smartd
#fi

###
### DESATIVADO ###
###
# Monitor the UPS with genpowerd.
# To use this, uncomment this section and edit your settings in
# /etc/genpowerd.conf (serial device, UPS type, etc).  For more information,
# see "man genpowerd" or the extensive documentation in the
# /usr/doc/genpower-*/ directory.
# You'll also need to configure a similar block in /etc/rc.d/rc.6 if you want
# support for stopping the UPS's inverter after the machine halts.
#if [ -x /sbin/genpowerd ]; then
#  echo "Starting genpowerd daemon..."
#  /sbin/genpowerd
#fi

###
### DESATIVADO ###
###
# Turn on process accounting.  To enable process accounting, make sure the
# option for BSD process accounting is enabled in your kernel, and then
# create the file /var/log/pacct (touch /var/log/pacct).  By default, process
# accounting is not enabled (since /var/log/pacct does not exist).  This is
# because the log file can get VERY large.
#if [ -x /sbin/accton -a -r /var/log/pacct ]; then
#  chmod 640 /var/log/pacct
#  /sbin/accton /var/log/pacct
#fi

# Start crond (Dillon's crond):
# If you want cron to actually log activity to /var/log/cron, then change
# -l notice to -l info to increase the logging level.
if [ -x /usr/sbin/crond ]; then
  /usr/sbin/crond -l notice
fi

# Start atd (manages jobs scheduled with 'at'):
if [ -x /usr/sbin/atd ]; then
  /usr/sbin/atd -b 15 -l 1
fi

###
### DESATIVADO ###
###
# Slackware-Mini-Quota-HOWTO:
# To really activate quotas, you'll need to add 'usrquota' and/or 'grpquota' to
# the appropriate partitions as listed in /etc/fstab.  Here's an example:
#
# /dev/hda2      /home      ext3     defaults,usrquota      1   1
#
# You'll then need to setup initial quota files at the top of the partitions
# to support quota, like this:
# touch /home/aquota.user /home/aquota.group
# chmod 600 /home/aquota.user /home/aquota.group
#
# Then, reboot to activate the system.
# To edit user quotas, use 'edquota'.  See 'man edquota'.  Also, the
# official Quota Mini-HOWTO has lots of useful information.  That can be found
# here:  /usr/doc/Linux-HOWTOs/Quota

# Check quotas and then turn quota system on:
#if grep -q quota /etc/fstab ; then
#  for quotafs in $(awk '/quota/ {print $2}' /etc/fstab) ; do
#    /bin/rm -f $quotafs/{a,}quota.{group,user}.new
#  done
#  if [ -x /sbin/quotacheck ]; then
#    echo "Checking filesystem quotas:  /sbin/quotacheck -avugm"
#    /sbin/quotacheck -avugm
#  fi
#  if [ -x /sbin/quotaon ]; then
#    echo "Activating filesystem quotas:  /sbin/quotaon -avug"
#    /sbin/quotaon -avug
#  fi
#fi

###
### DESATIVADO ###
###
# Start the SASL authentication server.  This provides SASL
# authentication services for sendmail:
#if [ -x /etc/rc.d/rc.saslauthd ]; then
#  . /etc/rc.d/rc.saslauthd start
#fi

###
### DESATIVADO ###
###
# Start the sendmail daemon:
#if [ -x /etc/rc.d/rc.sendmail ]; then
#  . /etc/rc.d/rc.sendmail start
#fi

# Load ALSA (sound) defaults:
if [ -x /etc/rc.d/rc.alsa ]; then
  . /etc/rc.d/rc.alsa
fi

###
### DESATIVADO ###
###
# Load a custom screen font if the user has an rc.font script.
#if [ -x /etc/rc.d/rc.font ]; then
#  . /etc/rc.d/rc.font
#fi

###
### DESATIVADO ###
###
# Load a custom keymap if the user has an rc.keymap script.
#if [ -x /etc/rc.d/rc.keymap ]; then
#  . /etc/rc.d/rc.keymap
#fi

###
### DESATIVADO ###
###
# Start the MySQL database:
#if [ -x /etc/rc.d/rc.mysqld ]; then
#  . /etc/rc.d/rc.mysqld start
#fi

###
### DESATIVADO ###
###
# Start Apache web server:
#if [ -x /etc/rc.d/rc.httpd ]; then
#  . /etc/rc.d/rc.httpd start
#fi

###
### DESATIVADO ###
###
# Start OpenLDAP:
#if [ -x /etc/rc.d/rc.openldap ]; then
#  . /etc/rc.d/rc.openldap start
#fi

###
### DESATIVADO ###
###
# Start Samba (a file/print server for Win95/NT machines).
# Samba can be started in /etc/inetd.conf instead.
#if [ -x /etc/rc.d/rc.samba ]; then
#  . /etc/rc.d/rc.samba start
#fi

###
### DESATIVADO ###
###
# Start the GPM mouse server:
#if [ -x /etc/rc.d/rc.gpm ]; then
#  . /etc/rc.d/rc.gpm start
#fi

# If there are SystemV init scripts for this runlevel, run them.
if [ -x /etc/rc.d/rc.sysvinit ]; then
  . /etc/rc.d/rc.sysvinit
fi

###
### MODIFICADO (acrescentada a opção de log) ###
###
# Start the local setup procedure.
if [ -x /etc/rc.d/rc.local ]; then
  . /etc/rc.d/rc.local 2>&1 > /var/log/rc_local.log &
fi

###
### MODIFICADO ###
###
# Register boot time
if [ -x /etc/rc.d/rc.boottime ]; then
  . /etc/rc.d/rc.boottime start
fi

# All done.

/etc/rc.d/rc.local

Este é meu script preferido, porque nele podemos passar parâmetros extras, executar comando, isso antes do início do ambiente gráfico.

Não sei como são as coisas em distros que usam systemd, mas o método oldschool é bem mais prático.

#!/bin/sh
#
# /etc/rc.d/rc.local:  Local system initialization script.
#
# Put any local startup commands in here.  Also, if you have
# anything that needs to be run at shutdown time you can
# make an /etc/rc.d/rc.local_shutdown script and put those
# commands in there.

#########################
# MORE INFO ABOUT CHANGES:
#
# http://allboutcomputer.wordpress.com/2012/07/16/turning-off-services-on-slackware/
# http://rra.etc.br/MyWorks/2011/10/28/iniciando-o-slackware-em-12s-ou-menos/
# https://edpsblog.wordpress.com/2015/04/06/how-to-tunando-a-inicializacao-do-slackware/
#
####################################################################################

#
# habilita o script /etc/rc.d/rc.update.
#
if [ -x /etc/rc.d/rc.update ]; then
  . /etc/rc.d/rc.update
fi

#
# habilita o WICD, já que desativei o DHCP.
#
if [ -x /etc/rc.d/rc.wicd ]; then
  echo "Starting network manager:  /etc/rc.d/rc.wicd start"
  /etc/rc.d/rc.wicd start
fi

#
# atualizar a hora, já que desativei o NTP.
#
chmod +x /etc/rc.d/rc.ntpd; ntpdate -u br.pool.ntp.org

exit 0

LILO e fstab.

Afim de manter a tela durante o processo de boot mais limpa, acrescentei a opção quiet em meu arquivo /etc/lilo.conf, segue o modelo que uso:

# LILO configuration file
# generated by 'liloconfig'

append=" vt.default_utf8=1"
boot = /dev/sda

bitmap = /boot/slack.bmp
bmp-colors = 255,0,255,0,255,0
bmp-table = 60,6,1,16
bmp-timer = 65,27,0,255

prompt
timeout = 100
change-rules
  reset

# Slackware Current.
image = /boot/vmlinuz
  root = /dev/disk/by-uuid/70f0dfb0-8b9b-444d-a9b9-46a13343c43a
  label = Slackware
  vga=791
  append="quiet"
  read-only

# Debian Wheezy.
image = /mnt/debian_rootfs/boot/vmlinuz-3.16.0-0.bpo.4-686-pae
  root = /dev/disk/by-uuid/172beeb6-c016-4359-aa3d-5956a5151016
  label = Wheezy
  initrd = /mnt/debian_rootfs/boot/initrd.img-3.16.0-0.bpo.4-686-pae
  read-only

# Debian Jessie.
image = /mnt/jessie/boot/vmlinuz-3.19.3-edps
  root = /dev/disk/by-uuid/07ea24b8-3da2-40cf-8e5c-cba64eb5c2b2
  label = Jessie
  initrd = /mnt/jessie/boot/initrd.img-3.19.3-edps
  read-only

Sobre como acrescentar outras distros ao LILO, vejam:

SLACKWARE :: ADICIONANDO OUTRAS DISTRIBUIÇÕES AO LILO

E quanto ao fstab (NÃO SIGA O MODELO ABAIXO EM AMBIENTES DE PRODUÇÃO!), meu Slack roda sobre o sistema de arquivos ext4 e visando uma melhor resposta do sistema de arquivos adicionei a opção noatime às opções de montagem, e desativei a opção dump, ficando assim meu fstab:

UUID=70f0dfb0-8b9b-444d-a9b9-46a13343c43a         /                ext4        noatime,errors=remount-ro         0   1
UUID=60e66a3e-acf9-4442-9de9-42026ca5e089    swap             swap        nofail         0   0
devpts           /dev/pts         devpts      gid=5,mode=620   0   0
proc             /proc            proc        defaults         0   0
tmpfs            /dev/shm         tmpfs       defaults         0   0

Pode não ser o recomendado mas minha máquina é um desktop, em caso de erros eu a corrijo, seja através de outra distro ou o que seja, caso estejam interessados em saber mais sobre opções de montagem sugiro a leitura de:

fstab @ Arch Wiki

Observações.

Não vejo necessidade em detalhar o que cada opção propõe, pois nas referências as explicações bastam por si só. Apesar disso, lembro que meu PC é um Desktop, portanto não preciso de servidores rodando (leia-se Apache, NFS, Samba e etc), trabalhos para impressão são impressos no Debian, mas deixei o CUPS habilitado por causa do cups-pdf, isso e outras coisas mais.

Cada máquina tem sua finalidade, portanto cabe a cada um decidir o que lhe é necessário, pois nem sempre o que é bom pra mim será para você, dito isto, se não entende a utilidade|finalidade desse ou daquele serviço ou mesmo caso tenha medo de testar as configurações propostas só lhe resta dizer a simples frase: não arrisque!

Referências.

Iniciando o Slackware em 12s ou menos

Turning off Services on Slackware

IntÉ!

Anúncios
How-To :: tunando a inicialização do Slackware

6 comentários sobre “How-To :: tunando a inicialização do Slackware

  1. rootgerr disse:

    Para o dhcp defina um endereço ip fixo (atrelado ao mac ) no seu rotedor e esqueça o dhcp essa b*sta atrasa mesmo o boot veja isto: 180ms network.service (retirado do meu systemd-analyze) antes com DHCP levava 10 segundos para achar o ip KKKK

    Curtir

Deixe um comentário

Preencha os seus dados abaixo ou clique em um ícone para log in:

Logotipo do WordPress.com

Você está comentando utilizando sua conta WordPress.com. Sair / Alterar )

Imagem do Twitter

Você está comentando utilizando sua conta Twitter. Sair / Alterar )

Foto do Facebook

Você está comentando utilizando sua conta Facebook. Sair / Alterar )

Foto do Google+

Você está comentando utilizando sua conta Google+. Sair / Alterar )

Conectando a %s