Обсуждение: Linux MANDRAKE startup startup script is broken ?

Поиск
Список
Период
Сортировка

Linux MANDRAKE startup startup script is broken ?

От
Oleg Bartunov
Дата:
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
removingit 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. 
Regards,
    Oleg

_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83





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

От
Lamar Owen
Дата:
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 !

?!?!?!?  Do something for me: add a couple of lines in
/etc/rc.d/init.d/postgresql after the postmaster start:
su -l postgres -c 'set >/var/lib/pgsql/envvars-l.lst'
su postgres -c 'set >/var/lib/pgsql/envvaqrs-no-l.lst'

And e-mail me the two '*.lst' files out of /var/lib/pgsql.

> I'm not an expert in su, at least I don't know what '-l' is supposed

>From man su:
SU(1)                          FSF                          SU(1)

NAME      su - run a shell with substitute user and group IDs

SYNOPSIS      su [OPTION]... [-] [USER [ARG]...]

DESCRIPTION      Change the effective user id and group id to that of USER.
      -, -l, --login             make the shell a login shell
......

> for, but it's worth to describe the problem and let people from
> MANDRAKE to know.

The same problem should manifest itself in RedHat, which is what I build
the RPM's for.  Mandrake has been taking the RedHat RPM's and using
them, with modifications, up till now, so, if I fix this in the RedHat
RPM's, the Mandrake RPM's will follow from Mandrake shortly.

--
Lamar Owen
WGCR Internet Radio
1 Peter 4:11


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

От
Dmitry Samersoff
Дата:
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

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