jgoldschrafe / rpm-uwsgi

RPM spec file and patches for uwsgi
http://repo.holyhandgrenade.org
15 stars 14 forks source link

Possible fixes/enhancements to init script #1

Open thehunmonkgroup opened 12 years ago

thehunmonkgroup commented 12 years ago

Here are a couple of adjustments I made to the init script to get it working for my needs. Some of these are bugfixes, others may or may not be suitable for inclusion -- I'm just including them all here for consideration:

--- uwsgi.orig  2012-10-06 08:30:52.000000000 -0400
+++ uwsgi   2012-10-06 09:30:02.000000000 -0400
@@ -30,7 +30,7 @@

 each_action() {
     action=$1
-    configs=$(find "$UWSGI_CONF_DIR" \
+    configs=$(find -L "$UWSGI_CONF_DIR" \
                    -maxdepth 1 \
                    -type f \
                    -regextype posix-extended \
@@ -54,6 +54,8 @@
                     start "$f"
                     ;;
                 status)
+                    instance=$(instance_for "$f")
+                    echo -n "${instance}: "
                     rh_status "$f"
                     ;;
                 status_q)
@@ -80,7 +82,7 @@
     pidfile=$(pidfile_for "$config_file")
     args="${UWSGI_ARGS} --pidfile ${pidfile} --daemonize ${UWSGI_LOG_DIR}/uwsgi-${instance}.log"
     case "$1" in
-        *.ini)        args="$args --ini $f";;
+        *.ini)        args="$args --ini-paste $f";;
         *.json)       args="$args --json $f";;
         *.xml)        args="$args --xmlconfig $f";;
         *.yml|*.yaml) args="$args --yaml $f";;
@@ -120,7 +122,7 @@
     args="$(args_for "$config_file")"

     echo -n "Starting uWSGI for ${instance}... "
-    daemon --pidfile="$pidfile" $uwsgi $args
+    daemon --pidfile "$pidfile" $uwsgi $args
     retval=$?
     echo
     return $retval

Quick summary of what I did:

jgoldschrafe commented 12 years ago

Thanks for this. I'm going to be updating this to use emperor mode (which didn't exist when I first wrote this init script) instead of manually managing instances, but the -L and --pidfile fixes are nice catches.