2012/6/7 Roberto De Ioris <[email protected]>
>
> Il giorno 07/giu/2012, alle ore 14:58, Jean-Baptiste Quenot ha scritto:
>
> > I get this in the log file:
> >
> > writing pidfile to /run/uwsgi/app/crunch/pid
> > open("/run/uwsgi/app/crunch/pid"): Permission denied [utils.c line 4196]
>
> Set the owner of that file to the user running uWSGI (with daemonize2 you
> are postponing the daemonization after privileges drop).
>
Instead of the hardcoded chown root:root I tried to do this in
/usr/share/uwsgi/init/snippets to no avail:
chown_and_chmod_pidfile()
{
local PIDFILE="$@"
local INTERVAL_START="$(date +%s)"
local INTERVAL_END="$(date +%s)"
local WAITING=2 # seconds
# Wait until daemon getting to create pidfile.
while [ ! -e "$PIDFILE" ]; do
INTERVAL_END="$(date +%s)"
if [ "$(expr "$INTERVAL_END" - "$INTERVAL_START")" -gt "$WAITING" ];
then
return
fi
sleep 0.05
done
local UWSGI_UID="$(extract_id uid "$RELATIVE_CONFPATH")"
local UWSGI_GID="$(extract_id gid "$RELATIVE_CONFPATH")"
chown $UWSGI_UID:$UWSGI_GID "$PIDFILE"
chmod 644 "$PIDFILE"
}
> If you do not want to mess with permissions, remove the old file and use
> --pidfile2
>
OK, it works with --pidfile2.
Thanks Roberto,
--
Jean-Baptiste Quenot
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi