#!/bin/sh # Copyright (C) 2010 Chris "Pada" Kistner # Modified by PacoLM to check only shared memory settings # 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. # if you find errors, check that coreutils are installed, if not, run the command below # apt-get -y install coreutils bc echo "--- Checking memory setting..." page_size=$(getconf PAGE_SIZE) mem_bytes=$(awk '/MemTotal:/ { printf "%0.f",$2 * 1024}' /proc/meminfo) mb=1048576 mem_bytes_mb=$(expr $mem_bytes / $mb) shmmax=$(echo "$mem_bytes * 0.90" | bc | cut -f 1 -d '.') shmmax_mb=$(expr $shmmax / $mb) shmall=$(expr $mem_bytes / $page_size) shmmax_cur=$(sysctl -n kernel.shmmax) shmmax_cur_mb=$(expr $shmmax_cur / $mb) shmall_cur=$(sysctl -n kernel.shmall) echo "-- Total memory = $mem_bytes B = $mem_bytes_mb MB" echo "-- Page size = $page_size B" echo "-- Current kernel.shmmax = $shmmax_cur B = $shmmax_cur_mb MB" echo "-- Current kernel.shmall = $shmall_cur pages" if [ "$shmmax" -eq "$shmmax_cur" ] && [ "$shmall" -eq "$shmall_cur" ]; then echo "-- Recommended shm values already set" else echo "-- Recommended: kernel.shmmax = $shmmax B = $shmmax_mb MB" echo "-- Recommended: kernel.shmall = $shmall pages" fi # Done echo "--- Done."
Підбираємо опримальний об'єм пам'яті для zoneminder
Підписатися на:
Дописати коментарі (Atom)
Немає коментарів:
Дописати коментар