Fabric doesn't launch Nginx remotely
Posted
by
endofu
on Server Fault
See other posts from Server Fault
or by endofu
Published on 2012-03-23T18:54:34Z
Indexed on
2012/03/24
11:31 UTC
Read the original article
Hit count: 379
I want to be able to start and stop an nginx server on an Ubuntu EC2 instance with Fabric.
I have this two scripts in my fabfile.py:
def start_nginx():
sudo('/etc/init.d/nginx start')
#also tried this: run('sudo /etc/init.d/nginx start')
def stop_nginx():
sudo('/etc/init.d/nginx stop')
The start_nginx() seemingly runs without errors (* Starting Nginx Server.../ ...done.) but doesn't start the server (or it dies immediately).
If I SSH into the instance this starts nginx perfectly:
sudo /etc/init.d/nginx start
The stop_nginx() Fabric script stops the server remotely.
I compiled nginx from source, using this http://nginx.org/download/nginx-1.1.9.tar.gz and using this script in /etc/init.d: https://github.com/JasonGiedymin/nginx-init-ubuntu/blob/master/nginx. The only thing I modified is this line:
DAEMON=/usr/local/sbin/nginx
to
DAEMON=/usr/sbin/nginx
because that's the path I used when I ./configure-d my compile.
Does anyone have any idea why the init script behaves differently being called from Fabric?
© Server Fault or respective owner