Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to make a small script to start up gunicorn for a python website I'm making. I have modified the script found at https://github.com/benoitc/gunicorn/blob/master/examples/gunicorn_rc slightly. Here's my version.

#!/bin/sh

GUNICORN=/usr/local/bin/gunicorn
ROOT=/srv/mobile-site/app
PID=/var/run/gunicorn.pid

APP=mobilecms:app

if [ -f $PID ]; then rm $PID fi        

cd $ROOT
exec $GUNICORN -b 127.0.0.1:8080 -w 8 -k gevent --pidfile=$PID $APP

When I try to run the script though, it shows this error

/etc/init.d/gunicorn: 13: Syntax error: end of file unexpected (expecting "fi")

Does anyone know what's wrong?

share|improve this question

1 Answer 1

up vote 6 down vote accepted

You need a semi-colon between rm $PID and fi. Like this:

if [ -f $PID ]; then rm $PID; fi 

The semi-colons are essentially shorthand so you can put this small if statement on a single line. Without them it would look like this:

if [ -f $PID ]
then
    rm $PID
fi 
share|improve this answer
    
that fixed it! thanks! –  tominated Mar 4 '11 at 6:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.