Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jul 3, 2009, 08:37 AM   #1
duggram
macrumors 6502
 
Join Date: Apr 2008
Setting shmmax in /etc/rc to install Postgres

How do I set shmmax in /etc/rc? Literally what would the entry look like and where do I put it in the file?

I'm revisiting a problem I've had for a while now. I can't run Postres on my MBP, OS X 10.5.7, 4GB RAM, because I can't set shmmax.

Here are the sys requirements from the postgres readme:
Code:
On a MacBook Pro with 2GB of RAM, the author's sysctl.conf contains:

kern.sysv.shmmax=1610612736
kern.sysv.shmall=393216
kern.sysv.shmmin=1
kern.sysv.shmmni=32
kern.sysv.shmseg=8
kern.maxprocperuid=512
kern.maxproc=2048
My current sysctl.conf file but the shmmax is never set:
Code:
kern.sysv.shmmax=4292870144
kern.sysv.shmall=393216
kern.sysv.shmmin=1
kern.sysv.shmmni=32
kern.sysv.shmseg=8
kern.maxprocperuid=512
kern.maxproc=2048
Results from doing a sysctl -a show that I only have a fraction of the shmmax memory required by Postgres to run. In fact when I try to start Postgres it throws up an error message and quits.
Code:
kern.sysv.shmall: 393216
kern.sysv.shmseg: 8
kern.sysv.shmmni: 32
kern.sysv.shmmin: 1
kern.sysv.shmmax: 4194304
kern.sysv.semume: 10
kern.sysv.semmsl: 87381
kern.sysv.semmnu: 87381
kern.sysv.semmns: 87381
kern.sysv.semmni: 87381

There is this post from another thread:
Quote:
Originally Posted by lee1210 View Post
http://joseph.randomnetworks.com/arc...sysctl-values/

That post has a discussion about this. The sysctl command will change things for the current session, but you'll need to change the value in /etc/rc or all shmem values in sysctl.conf for this to survive a reboot. ...
-Lee
Here is my current rc.common file:
Code:
##
# Common setup for startup scripts.
##
# Copyright 1998-2002 Apple Computer, Inc.
##

#######################
# Configure the shell #
#######################

##
# Be strict
##
#set -e
set -u

##
# Set command search path
##
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/libexec:/System/Library/CoreServices; export PATH

##
# Set the terminal mode
##
#if [ -x /usr/bin/tset ] && [ -f /usr/share/misc/termcap ]; then
#    TERM=$(tset - -Q); export TERM
#fi

####################
# Useful functions #
####################

##
# Determine if the network is up by looking for any non-loopback
# internet network interfaces.
##
CheckForNetwork()
{
    local test

    if [ -z "${NETWORKUP:=}" ]; then
	test=$(ifconfig -a inet 2>/dev/null | sed -n -e '/127.0.0.1/d' -e '/0.0.0.0/d' -e '/inet/p' | wc -l)
	if [ "${test}" -gt 0 ]; then
	    NETWORKUP="-YES-"
	else
	    NETWORKUP="-NO-"
	fi
    fi
}

alias ConsoleMessage=echo

##
# Process management
##
GetPID ()
{
    local program="$1"
    local pidfile="${PIDFILE:=/var/run/${program}.pid}"
    local     pid=""

    if [ -f "${pidfile}" ]; then
	pid=$(head -1 "${pidfile}")
	if ! kill -0 "${pid}" 2> /dev/null; then
	    echo "Bad pid file $pidfile; deleting."
	    pid=""
	    rm -f "${pidfile}"
	fi
    fi

    if [ -n "${pid}" ]; then
	echo "${pid}"
	return 0
    else
	return 1
    fi
}

##
# Generic action handler
##
RunService ()
{
    case $1 in 
      start  ) StartService   ;;
      stop   ) StopService    ;;
      restart) RestartService ;;
      *      ) echo "$0: unknown argument: $1";;
    esac
}

##########################
# Get host configuration #
##########################
. /etc/hostconfig
Any suggestions would be greatly appreciated.

Thank you, Doug
duggram is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Not enough ram to install lion? aerlenbach MacBook 2 Sep 2, 2011 10:54 PM
Am I able to install Lion from 2011 macbook Air? chibamac Mac OS X 10.7 Lion 12 Jul 21, 2011 06:01 PM
Can I still choose in which language to install Lion regardless of my location? doxavita Mac OS X 10.7 Lion 0 Jul 21, 2011 01:48 PM
How to Install Windows 7 RC on Parallels and Bootcamp needthephone Windows, Linux & Others on the Mac 3 May 8, 2009 10:15 AM
Setting text in a label to a variable upon button press Jeremy1026 iPhone/iPad Programming 1 Jul 18, 2008 09:39 AM


All times are GMT -5. The time now is 09:41 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC