File: dotest

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 (54 lines) | stat: -rwxr-xr-x 1,501 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
# Author: Robert Martin
# Checks sysctl variable vaues on OSX to see if they are large enough
# to handle the shared memory requirements for ION

# documentation boilerplate
echo "########################################"
echo
pwd | sed "s/\/.*\///" | xargs echo "NAME: "
echo
echo "PURPOSE: Determine if an Apple OSX host has the minimum memory required
	for ION to run properly."
echo
echo "CONFIG: None"
echo
echo "OUTPUT: If the host is Apple OSX and memory is not sufficient, then you
	will be informed how to edit system configuration files to meet minimum
	memory requirements."
echo
echo "########################################"

if ! sw_vers 2> /dev/null > /dev/null; then
       echo "Not an OSX system, skipping test"
       exit 2
fi

VAR_LIST=('shmmax' 'shmmin' 'shmmni' 'shmseg' 'shmall')
VAR_VALUE=(20971520 1 32 128 8192)
CUR_VALUE=0
I=0
CHANGE=0

echo
echo "If any lines appear below, copy and paste them into /etc/sysctl.conf and reboot."

while [[ "$I" -lt  "5" ]]; do
        CUR_VALUE=`sysctl kern.sysv.${VAR_LIST[$I]} | awk '{ print $2 }'`
	#echo "Checking kern.sysv.${VAR_LIST[$I]} $CUR_VALUE  ${VAR_VALUE[$I]}"
	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