RE: [HACKERS] Linux MANDRAKE startup startup script is broken ?

Поиск
Список
Период
Сортировка
От Dmitry Samersoff
Тема RE: [HACKERS] Linux MANDRAKE startup startup script is broken ?
Дата
Msg-id XFMail.20000206000109.dms@wplus.net
обсуждение исходный текст
Ответ на Linux MANDRAKE startup startup script is broken ?  (Oleg Bartunov <oleg@sai.msu.su>)
Список pgsql-hackers
On 05-Feb-2000 Oleg Bartunov wrote:
> Hi,
> 
> I had a request from bulgarian user of postgres. He complained
> about non-working locale. His system is MANDRAKE 7.0 which comes
> with postgres 6.5.3 I believe. After several messages we found
> that problem was in startup script /etc/init.d/rc3.d
>    su -l postgres -c 'postmaster .......'
>  The problem was '-l', after removing it all problems were solved !
> I'm not an expert in su, at least I don't know what '-l' is supposed
> for, but it's worth to describe the problem and let people from
> MANDRAKE to know. 

Switch -l cause su to emulate login procedure, 
i.e rewrite all environment. 
I use simple program to avoid such kind of collision,
and apropriate startup script

(see below sign)


-- 
Dmitry Samersoff, dms@wplus.net, ICQ:3161705
http://devnull.wplus.net
* There will come soft rains ...

==================== cat ===========================
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include <pwd.h>


int main(int argc, char *argv[])
{ struct passwd *pw; uid_t u; if (!argv[1])  { fprintf(stderr,"usage: su_postgres command\n");    exit(0);  }
 pw = getpwnam("postgres"); if (!pw)   { fprintf(stderr, "user postgres doesn't exist\n");     exit(0);
}setuid(pw->pw_uid);seteuid(pw->pw_uid);
u = geteuid();if( u != pw->pw_uid)  { fprintf(stderr,"Can\'t change uid to %d\n", pw->pw_uid);    exit(0);  }
system(argv[1]);

}

=================================================================
# $Id: S81pgsql.in,v 1.2 1999/08/31 14:21:19 dms Exp $

PG_HOME="/usr/local/pgsql"
PG_DATA="$PG_HOME/data"
UDS="/tmp/.s.PGSQL.5432"

PS="@PS@"
GREP="@GREP@"

case "$1" in
'start')       # If no postgres run, remove UDS and start postgres.       pid=       set -- `$PS | $GREP postmaster |
$GREP-v grep`       [ $? -eq 0 ] && pid=$1
 
       if [ -z "$pid" ]; then               rm -f "$UDS"               $PG_HOME/bin/su_postgres
"$PG_HOME/bin/postmaster-D $PG_DATA -b$PG_HOME/bin/postgres -i -S -o -F &"               echo "Postgres started"
else        echo "Postmaster already run with pid $pid"       fi       ;;
 
'stop')       pid=       set -- `$PS | $GREP postmaster | $GREP -v grep`       [ $? -eq 0 ] && pid=$1
       if [ -z "$pid" ]; then        echo "Postgres not run"       else        echo "Stoping postmaster with pid $pid"
      kill $pid       fi
 
       ;;
*)       echo "USAGE: $0 {start | stop}"       ;;
esac

=================================================================


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Oleg Bartunov
Дата:
Сообщение: Re: [HACKERS] Linux MANDRAKE startup startup script is broken ? (fwd)
Следующее
От: Tom Lane
Дата:
Сообщение: Proposal for new SET variables for optimizer costs