If I log in as user www-data and run this command it works:
python /var/www/ssrc/jvwf/manage.py runfcgi --settings=spzr.settings-dev \\
method=prefork socket=/tmp/www/spzr.socket pidfile=/tmp/www/spzr.pid \\
minspare=4 maxspare=8 maxchildren=128 maxrequests=65535 daemonize=false
However when I run it from root, in the following way (to be run as www-data):
exec /bin/su -c "python /var/www/ssrc/jvwf/manage.py runfcgi \\
--settings=spzr.settings-dev --pythonpath=/var/www/ssrc/jvwf \\
method=prefork socket=/tmp/www/spzr.socket pidfile=/tmp/www/spzr.pid \\
minspare=4 maxspare=8 maxchildren=128 maxrequests=65535 \\
daemonize=false" - www-data
it does not work.
Practically the second command is just:
exec /bin/su -c "FIRST_COMMAND" - www-data
The issue is that it cannot properly import the an intermediate settings file imported from within the settings file passed. I guess it’s an ENV (or path) issue, but I don’t know how to fix it.
(The \\ above are line separators for display purposes, I’m using one liners in reality)
one difference would be that when using su with the – option it cds to the home directory automatically. try adding a cd in front of your command:
otherwise: what error messages do you get?