Esempio n. 1
0
def use_noop_scheduler():
    """Switches from deadline to noop scheduler of processes for the kernel.

    Noop minimizes CPU usage of the scheduler.

    """
    ensure_line('/boot/cmdline.txt', 'deadline', 'noop')
Esempio n. 2
0
def set_swapsize(size=100, swappiness=1, cache_pressure=50):
    "Specifies the raspberry pi's swap size, usage, and swap file cache."
    if size > 0:
        sudo('echo "CONF_SWAPSIZE={0}" > /etc/dphys-swapfile'.format(size))
        sudo('dphys-swapfile setup')
        sudo('dphys-swapfile swapon')
    else:
        sudo('swapoff -a')

    ensure_line('/etc/sysctl.conf', 'vm.swappiness=[0-9]*', 'vm.swappiness={0}'.format(swappiness))
    ensure_line('/etc/sysctl.conf', 'vm.vfs_cache_pressure=[0-9]*', 'vm.vfs_cache_pressure={0}'.format(cache_pressure))
Esempio n. 3
0
def disable_ipv6():
    "Disable IPv6."
    sudo('echo "net.ipv6.conf.all.disable_ipv6=1" > /etc/sysctl.d/disableipv6.conf')
    ensure_line("/etc/modprobe.d/blacklist", "blacklist ipv6")
    sudo("sed -i '/::/s%^%#%g' /etc/hosts")