Hi

This is driving me crazy. I write again what I have:

uwsgi.ini:

[uwsgi]
pythonpath = /home/web2py/
module = wsgihandler
socket = 127.0.0.1:9001
master = true
uid = www
gid = www
#enable-threads = true
processes = 4
socket-timeout = 180
post-buffering = 8192
max-requests = 1000
buffer-size = 32768

rc.conf:
uwsgi_enable="YES"
uwsgi_flags="-T --ini /usr/local/etc/uwsgi.ini"

The startup script is:

#!/bin/sh
#
# $FreeBSD: www/uwsgi/files/uwsgi.in 307795 2012-11-26 20:23:49Z demon $
#
# PROVIDE: uwsgi
# REQUIRE: DAEMON
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable uwsgi:
#
# uwsgi_enable (bool): Set it to "YES" to enable uwsgi
# Default is "NO".
# uwsgi_socket (path/str): Set the path to the uwsgi unix socket
# Default is /tmp/uwsgi.sock.
# uwsgi_logfile (path): Set the path to the uwsgi log file
# Default is /var/log/uwsgi.log.
# uwsgi_pidfile (path): Set the path to the uwsgi pid file
# Default is /var/run/uwsgi.pid.
# uwsgi_uid (int): Set the UID of the process to run with
# Default is 80.
# uwsgi_gid (int): Set the GID of the process to run with
# Default is 80.
# uwsgi_flags (str): Set the uwsgi command line arguments
# Default is "-M -L".
# uwsgi_procname (str): Define to "uWSGI" if you start uwsgi with
# --auto-procname option.
#
# If you would like to have multiple uWSGI instances running, you can
# define multiple profiles:
#
# uwsgi_profiles (str): Set the list of uwsgi profiles
# Default is "".
#
# For each profile you can then define different options (except for
# uwsgi_enable) using the syntax uwsgi_<profile>_<option>

. /etc/rc.subr

name="uwsgi"
rcvar=uwsgi_enable

load_rc_config $name

command=/usr/local/bin/uwsgi
: ${uwsgi_enable="NO"}
: ${uwsgi_profiles=""}
: ${uwsgi_socket="/tmp/${name}.sock"}
: ${uwsgi_logfile="/var/log/${name}.log"}
: ${uwsgi_pidfile="/var/run/${name}.pid"}
: ${uwsgi_uid="80"}
: ${uwsgi_gid="80"}
: ${uwsgi_flags="-M -L"}
: ${uwsgi_procname="${command}"}

is_uwsgi_profile() {
    local profile

    for profile in $uwsgi_profiles; do
        if [ "$profile" = "$1" ]; then
            return 0
        fi
    done

    return 1
}

if [ -n "${uwsgi_profiles}" ]; then
if [ -n "$2" ]; then
profile="$2"
if ! is_uwsgi_profile $profile; then
echo "$0: no such profile defined in uwsgi_profiles."
        exit 1
fi
eval
uwsgi_socket=\${uwsgi_${profile}_socket:-"/tmp/${name}-${profile}.sock"}
eval
uwsgi_logfile=\${uwsgi_${profile}_logfile:-"/var/log/${name}-${profile}.log"}
eval
uwsgi_pidfile=\${uwsgi_${profile}_pidfile:-"/var/run/${name}-${profile}.pid"}
eval uwsgi_uid=\${uwsgi_${profile}_uid:-"${uwsgi_uid}"}
eval uwsgi_gid=\${uwsgi_${profile}_gid:-"${uwsgi_uid}"}
eval uwsgi_flags=\${uwsgi_${profile}_flags:-"${uwsgi_flags}"}
eval uwsgi_procname=\${uwsgi_${profile}_procname:-"${uwsgi_procname}"}
elif [ -n "$1" ]; then
for profile in ${uwsgi_profiles}; do
            echo "Processing ${name} profile: ${profile}"
            /usr/local/etc/rc.d/uwsgi $1 ${profile}
        done
        exit 0
fi
fi

command=/usr/local/bin/uwsgi
command_args="--pidfile ${uwsgi_pidfile} -s ${uwsgi_socket} -d
${uwsgi_logfile} --uid ${uwsgi_uid} --gid ${uwsgi_gid} ${uwsgi_flags}"
pidfile=${uwsgi_pidfile}
stop_postcmd=stop_postcmd
reload_precmd=reload_precmd
brutalreload_cmd=brutalreload_cmd
sig_stop="INT"
extra_commands="reload brutalreload"
procname=${uwsgi_procname}

stop_postcmd()
{
rm -f ${uwsgi_pidfile} ${uwsgi_socket}
}

reload_precmd()
{
echo "Gracefully reloading ${name} without closing the main sockets."
}

brutalreload_cmd()
{
echo "Reloading ${name} without closing the main sockets."

reload_precmd=""
sig_reload="TERM"
run_rc_command ${rc_prefix}reload $rc_extra_args || return 1
}

run_rc_command "$1"



If I try to start with:

/usr/local/etc/rc.d/uwsgi start

error occurs (Permission denied) and may not start. However, if you I start
from the command line, without using the script, it works fine.

# uwsgi --ini /usr/local/etc/uwsgi.ini &

# sockstat -4 | grep uwsgi
www      uwsgi      7206  3  tcp4   127.0.0.1:9001        *:*
www      uwsgi      7205  3  tcp4   127.0.0.1:9001        *:*
www      uwsgi      7204  3  tcp4   127.0.0.1:9001        *:*
www      uwsgi      7203  3  tcp4   127.0.0.1:9001        *:*
www      uwsgi      7191  3  tcp4   127.0.0.1:9001        *:*


I checked the startup script of my notebook and server are the same. There
is no difference.

José
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to