bashrc & zshrc: add functions to set sysctl...

...how I want.
This commit is contained in:
Mikaela Suomalainen 2014-09-24 17:14:36 +03:00
parent 78695eb73c
commit d4b917a3e9
2 changed files with 60 additions and 0 deletions

30
bashrc
View File

@ -816,6 +816,36 @@ else
#unset CXX #unset CXX
fi fi
# Function to temporarily set sysctl options which I want and echo how to
# set them permanently
function sysctl-mikaela() {
set -x
sysctl kernel.core_pattern=%e-%p-%h.core
sysctl vm.swappiness=1
echo 'echo kernel.core_pattern = %e-%p-%h.core >> /etc/sysctl.conf'
echo 'echo vm.swappiness = 1 >> /etc/sysctl.conf'
set +x
}
# Function to permanently set sysctl options which I want.
function sysctl-mikaela-run() {
set -x
echo 'echo kernel.core_pattern = %e-%p-%h.core >> /etc/sysctl.conf'
echo 'echo vm.swappiness = 1 >> /etc/sysctl.conf'
sysctl -p
set +x
}
# Function to undo sysctl-mikaela
function sysctl-undo-mikaela() {
set -x
sysctl kernel.core_pattern=core
sysctl vm.swappiness=60
echo 'echo kernel.core_pattern = %e-%p-%h.core >> /etc/sysctl.conf'
echo 'echo vm.swappiness = 1 >> /etc/sysctl.conf'
set +x
}
# .custom # .custom
if [ -f ~/.custom ]; then if [ -f ~/.custom ]; then
source ~/.custom source ~/.custom

30
zshrc
View File

@ -789,6 +789,36 @@ else
#unset CXX #unset CXX
fi fi
# Function to temporarily set sysctl options which I want and echo how to
# set them permanently
function sysctl-mikaela() {
set -x
sysctl kernel.core_pattern=%e-%p-%h.core
sysctl vm.swappiness=1
echo 'echo kernel.core_pattern = %e-%p-%h.core >> /etc/sysctl.conf'
echo 'echo vm.swappiness = 1 >> /etc/sysctl.conf'
set +x
}
# Function to permanently set sysctl options which I want.
function sysctl-mikaela-run() {
set -x
echo 'echo kernel.core_pattern = %e-%p-%h.core >> /etc/sysctl.conf'
echo 'echo vm.swappiness = 1 >> /etc/sysctl.conf'
sysctl -p
set +x
}
# Function to undo sysctl-mikaela
function sysctl-undo-mikaela() {
set -x
sysctl kernel.core_pattern=core
sysctl vm.swappiness=60
echo 'echo kernel.core_pattern = %e-%p-%h.core >> /etc/sysctl.conf'
echo 'echo vm.swappiness = 1 >> /etc/sysctl.conf'
set +x
}
# Source files for miscannellious modifications. # Source files for miscannellious modifications.