File: sysctl_script.sh

package info (click to toggle)
ion 3.2.1%2Bdfsg-1.1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 23,768 kB
  • ctags: 11,049
  • sloc: ansic: 141,798; sh: 22,848; makefile: 7,818; python: 1,638; sql: 311; perl: 197; awk: 178; xml: 50; java: 19
file content (38 lines) | stat: -rwxr-xr-x 1,000 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
# Author: Robert Martin, Ohio University
# Checks sysctl variable vaues on OSX to see if they are large enough
# to handle the shared memory requirements for ION

if [[ $OSTYPE != *darwin* ]]; then
       echo "Not an OSX system, exiting script"
       exit 0
fi

VAR_LIST=('shmmax' 'shmmin' 'shmmni' 'shmseg' 'shmall')
VAR_VALUE=(10485760 1 32 32 4096)
CUR_VALUE=0
I=0
CHANGE=0

echo
echo "If any lines appear below, copy and paste them into /etc/sysctl.conf and reboot."
echo "If /etc/sysctl.conf does not yet exist, create it."

while [[ $I -lt 5 ]]; do
        CUR_VALUE=`sysctl kern.sysv.${VAR_LIST[$I]} | awk '{ print $2 }'`
        if [[ $CUR_VALUE -lt ${VAR_VALUE[$I]} ]]; then
		echo "kern.sysv.${VAR_LIST[$I]}=${VAR_VALUE[I]}"
                let CHANGE=1
        fi
        let I=$I+1
done

if [[ $CHANGE == 0 ]]; then
	echo
	echo "This system's shared memory is ready to run ION."
	echo "No changes are needed."
	exit 0
fi

#If there's a problem, we exit with an error
exit 1