Re: /dev/stderr gets unlinked 8]

From: Denis Vlasenko
Date: Wed Mar 15 2006 - 08:29:25 EST


On Wednesday 15 March 2006 13:02, Stefan Seyfried wrote:
> On Tue, Mar 14, 2006 at 03:35:57PM +0200, Denis Vlasenko wrote:
>
> > Mysql people are strange. For example, their daemon does not want to die
> > on SIGTERM, this makes it harder to run it under daemontools.
>
> Well, daemontools are equally strange ;-))

IMHO the most sane way to control zillions of background processes.

> > Also it drops privileges BEFORE it opens logfiles (--log=xxx).
> > I cannot get it to log stuff on stderr:
> >
> > echo "* Starting mysqld"
> > env - \
> > setuidgid root \
> > mysqld \
> > --defaults-file="$PWD/my.cnf" \
> > --user="$user" \
> > --datadir="$var/data" \
> > --tmpdir="$var/tmp" \
> > --socket="$PWD/mysql.socket" \
> > --pid-file="$PWD/mysql.pid" \
> > --skip-name-resolve \
> > --skip-innodb \
> > --skip-ndbcluster \
> > --skip-networking \
> > --log=/proc/self/fd/2 \
> > --log-slow-queries=/proc/self/fd/2 \
> >
> > Those last two options don't work:
> >
> > mysqld: File '/proc/self/fd/2' not found (Errcode: 13)
>
> any good daemon closes stdout, stderr, stdin and does chdir(/) on startup.
> msqld might do so as well.

No. Good daemon (e.g. apache does it) will open log file first, and _then_
will do setuid($user). Mysql tries to do it in opposite order, and (no wonder)
fails to open the log.
--
vda
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/