-
Notifications
You must be signed in to change notification settings - Fork 6
/
sysctl_script.sh
executable file
·45 lines (41 loc) · 1.35 KB
/
sysctl_script.sh
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
#!/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
case $OSTYPE in
*darwin*)
VAR_LIST=('kern.sysv.shmmax' 'kern.sysv.shmmin' 'kern.sysv.shmmni'
'kern.sysv.shmseg' 'kern.sysv.shmall' 'net.inet.udp.maxdgram'
'kern.sysv.semmns' 'kern.sysv.semmni')
;;
*freebsd*)
VAR_LIST=('kern.ipc.shmmax' 'kern.ipc.shmmin' 'kern.ipc.shmmni'
'kern.ipc.shmseg' 'kern.ipc.shmall' 'net.inet.udp.maxdgram'
'kern.ipc.semmns' 'kern.ipc.semmni')
;;
*)
echo "No need to update sysctl variables."
exit 0
;;
esac
VAR_VALUE=(83886080 1 32 32 32768 32000 32000 128)
CUR_VALUE=0
I=0
CHANGE=0
while [[ $I -lt ${#VAR_LIST[@]} ]]; do
CUR_VALUE=`sysctl ${VAR_LIST[$I]} | awk '{ print $2 }'`
if [[ $CUR_VALUE -lt ${VAR_VALUE[$I]} ]]; then
echo "${VAR_LIST[$I]}=${VAR_VALUE[I]}"
let CHANGE=1
fi
let I=$I+1
done
if [[ $CHANGE == 0 ]]; then
echo "This system is ready to run ION."
else
echo
echo "Your system's sysctl configuration needs be updated in order to"
echo "run ION. This is usually done by copying the above assignments into"
echo "/etc/sysctl.conf or /boot/loader.conf and rebooting."
exit 1
fi