diff options
Diffstat (limited to 'system/postgresql/rc.postgresql.new')
-rw-r--r-- | system/postgresql/rc.postgresql.new | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/system/postgresql/rc.postgresql.new b/system/postgresql/rc.postgresql.new index 5eef25badd849..6ccda6a3355e9 100644 --- a/system/postgresql/rc.postgresql.new +++ b/system/postgresql/rc.postgresql.new @@ -18,6 +18,14 @@ DATADIR=/var/lib/pgsql/data POSTGRES=/usr/bin/postgres PIDFILE=postmaster.pid +# oom-killer score +# if defined and set to -1000, main postmaster wont be killed +# by Linux OOM killer, but individual backends still could be +# (since OOM_SCORE_ADJ in SlackBuild is set to 0) +# +# http://www.kernel.org/doc/Documentation/filesystems/proc.txt +OOM_SCORE_ADJ=-1000 + # Return values (according to LSB): # 0 - success # 1 - generic or unspecified error @@ -65,6 +73,7 @@ case "$1" in if [ ! -f $DATADIR/$PIDFILE ]; then rm -f /tmp/.s.PGSQL.5432 rm -f /tmp/.s.PGSQL.5432.lock + test x"$OOM_SCORE_ADJ" != x && echo "$OOM_SCORE_ADJ" > /proc/self/oom_score_adj pg_ctl start -w -l $LOGFILE -D $DATADIR exit 0 else @@ -89,7 +98,7 @@ case "$1" in ;; "unclean-stop") - # Take care: This will abort server process itself + # Take care! This will abort server process itself # resulting with database recovery on next start. echo "Shutting down PostgreSQL (immediate)..." pg_ctl stop -l $LOGFILE -D $DATADIR -m immediate @@ -97,6 +106,7 @@ case "$1" in "restart") echo "Restarting PostgreSQL..." + test x"$OOM_SCORE_ADJ" != x && echo "$OOM_SCORE_ADJ" > /proc/self/oom_score_adj pg_ctl restart -l $LOGFILE -D $DATADIR -m smart ;; |