Use tools/editconf.py to manipulate sysctl.conf

This commit is contained in:
Michael Kroes 2016-03-14 11:40:54 +01:00
parent 326cb96799
commit e9677ae68d
1 changed files with 4 additions and 10 deletions

View File

@ -33,19 +33,13 @@ if [ ! -e /swapfile ]; then
echo "/swapfile none swap sw 0 0" >> /etc/fstab echo "/swapfile none swap sw 0 0" >> /etc/fstab
# Make sure the system only swaps as a last resort # Make sure the system only swaps as a last resort
SWAPPINESS=$(grep vm.swappiness /etc/sysctl.conf) hide_output sysctl vm.swappiness=10
if [ -z "$SWAPPINESS" ]; then tools/editconf.py /etc/sysctl.conf vm.swappiness=10
hide_output sysctl vm.swappiness=10
echo "vm.swappiness=10" >> /etc/sysctl.conf
fi
# Make sure the systeem keeps the file system inodes in # Make sure the systeem keeps the file system inodes in
# memory as long as possible # memory as long as possible
PRESSURE=$(grep vm.vfs_cache_pressure /etc/sysctl.conf) hide_output sysctl vm.vfs_cache_pressure=50
if [ -z "$PRESSURE" ]; then tools/editconf.py /etc/sysctl.conf vm.vfs_cache_pressure=50
hide_output sysctl vm.vfs_cache_pressure=50
echo "vm.vfs_cache_pressure=50" >> /etc/sysctl.conf
fi
fi fi
fi fi
fi fi