[Eisfair] /var/install/config.d/sysctl.sh

Uwe Kunze u.kunze.sdh at t-online.de
Di Jul 25 23:23:09 CEST 2017


Hier mal das ganze Script:



#!/bin/sh
#----------------------------------------------------------------------------------------
# /var/install/config.d/sysctl.sh - configuration generator script for 
sysctl
#
# Copyright (c) 2007 Daniel Vogel <daniel_vogel(at)t-online(dot)de>
#
# Creation:     2007-03-04
# Last Update:  $Id$
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#----------------------------------------------------------------------------------------

. /var/install/include/eislib
. /etc/config.d/sysctl


#----------------------------------------------------------------------------------------
# Write sysctl.conf
#----------------------------------------------------------------------------------------

write_sysctl_conf ()
{
     mecho -info "Updating kernel configuration..."

     # write file header
     {
         echo 
"#----------------------------------------------------------------------------"
         echo "# /etc/sysctl.conf - sysctl configuration file"
         echo "# generated by /var/install/config.d/sysctl.sh"
         echo "#"
         echo "# Creation date: `date`"
         echo 
"#----------------------------------------------------------------------------"
         echo ""
     } > /etc/sysctl.conf

     # write package extensions
     {
         files=$(ls /etc/sysctl.*)
         for file in $files
         do
             if [ "$file" != "/etc/sysctl.conf" ]
             then
                 cat "$file"
                 echo ""
             fi
         done
     } >> /etc/sysctl.conf

     # write user settings
     {
         echo 
"#----------------------------------------------------------------------------"
         echo "# User settings"
         echo 
"#----------------------------------------------------------------------------"
         echo ""

         idx=1
         while [ "$idx" -le "$SYSCTL_PARAM_N" ]
         do
             eval name='$SYSCTL_PARAM_'$idx'_NAME'
             eval value='$SYSCTL_PARAM_'$idx'_VALUE'

             echo "$name = $value"

             idx=$[$idx + 1]
	done

         echo ""
         echo 
"#----------------------------------------------------------------------------"
         echo "# End"
         echo 
"#----------------------------------------------------------------------------"

     } >> /etc/sysctl.conf
     chmod 600 /etc/sysctl.conf
}


#----------------------------------------------------------------------------------------
# Main
#----------------------------------------------------------------------------------------

# write host access table
write_sysctl_conf

# update kerenl parameters
sysctl -p

#----------------------------------------------------------------------------------------
# End
#----------------------------------------------------------------------------------------
exit 0


Mehr Informationen über die Mailingliste Eisfair