Created
August 31, 2012 03:22
-
-
Save mbohun/3548621 to your computer and use it in GitHub Desktop.
rc.local BASH notest
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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. | |
# | |
# | |
# | |
# TODO: check if there is not a clash between | |
# some governors (powersave) and fiddling with | |
# Processor cooling_device settings | |
# | |
# for d in `find /sys/class/thermal/cooling_device*` | |
# do | |
# max=`cat $d/max_state` | |
# echo $max > $d/cur_state | |
# #echo $[ ${max} - 1 ] > $d/cur_state | |
# done | |
/usr/bin/cpufreq-set --max 1330000 | |
# /usr/bin/cpufreq-set --governor conservative | |
# TODO: this needs proper fix, as it gets restarted and hogs | |
# the CPU again. | |
# /usr/bin/pkill v86d | |
# ingo said no | |
# /sbin/sysctl vm.swappiness=10 | |
# echo 5 > /proc/sys/vm/laptop_mode | |
# the wireless (ipw2200?) seems to need this | |
echo 120 > /sys/class/firmware/timeout | |
if [ -e "/sys/kernel/mm/ksm/run" ] | |
then | |
/bin/echo 1 > /sys/kernel/mm/ksm/run | |
fi | |
if [ -e "/sys/class/net/eth1/device/power/wakeup" ] | |
then | |
/bin/echo "enabled" > /sys/class/net/eth1/device/power/wakeup | |
/usr/sbin/wpa_supplicant -B -Dwext -ieth1 -c /etc/wpa_supplicant.conf | |
/sbin/dhcpcd -h `/bin/hostname` eth1 | |
fi | |
if [ -e "/sys/class/net/wlan1" ] | |
then | |
/usr/sbin/wpa_supplicant -B -Dwext -iwlan1 -c /etc/wpa_supplicant.conf | |
/sbin/dhcpcd -h `/bin/hostname` wlan1 | |
fi | |
# TODO: ttyUSB[0-9] | |
# make a script and udev rule | |
# - or should we use sysfs !!! <- most likely YES | |
# | |
if [ -e "/sys/bus/usb-serial/devices/ttyUSB0" ] | |
then | |
/bin/echo "nameserver 127.0.0.1" >> /etc/resolv.conf | |
fi | |
# oversimplyfied ntpdate usage | |
/usr/sbin/ntpdate ntp.internode.on.net > /dev/null 2>&1 | |
UNAME=`/bin/uname -r` | |
DATE=`/bin/date "+%Y-%m-%d-%H-%M-%S"` | |
# flush mem caches | |
# | |
sync; echo 3 > /proc/sys/vm/drop_caches | |
cp /proc/config.gz /var/log/$DATE-$UNAME-config.gz |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment