Below is a part of the /etc/init.d script that controls a daemon. The full init.script is available at http://pastebin.com/02G5tpgHcase $1 instart)        printf %-50s Starting $DAEMON_NAME...        cd $DIR        [ -d $LOGPATH ] || mkdir $LOGPATH  [ -f $LOGFILE ] || su $DAEMON_USER -c 'touch $LOGFILE'        PID=`$PYTHON $DAEMON $DAEMON_OPTS > $LOGFILE  2>&1 & echo $!`        #echo Saving PID $PID  to  $PIDFILE        if [ -z $PID ]; then            printf %s\n Fail        else            echo $PID > $PIDFILE            printf %s\n Ok        fi;;status)        printf %-50s Checking $DAEMON_NAME...        if [ -f $PIDFILE ]; then            PID=`cat $PIDFILE`            if [ -z `ps axf | grep ${PID} | grep -v grep` ]; then                printf %s\n Process dead but pidfile exists            else                echo Running            fi        else            printf %s\n Service not running        fi;;stop)        printf %-50s Stopping $DAEMONNAME            PID=`cat $PIDFILE`            cd $DIR        if [ -f $PIDFILE ]; then            kill -HUP $PID            printf %s\n Ok            rm -f $PIDFILE        else            printf %s\n pidfile not found        fi;;restart)        $0 stop        $0 start;;*)        echo Usage: $0 {status|start|stop|restart}        exit 1esacI use capistrano2 to deploy/update this application. So prior to the deploy, i have a task to stop the application/service and then another task to start the service post deploy task. The service is never started successfully in this process via the capistrano task. It throws the error. Process dead but pidfile existsManually stopping and starting cannot replicate this issue. So looks like some kind of deamon issue, where the service will not start when called via scriptEDITING:As per the evidences so far, looks like its failing at this part of the script. case $1 instart)        printf %-50s Starting $DAEMON_NAME...        cd $DIR        [ -d $LOGPATH ] || mkdir $LOGPATH  [ -f $LOGFILE ] || su $DAEMON_USER -c 'touch $LOGFILE'        PID=`$PYTHON $DAEMON $DAEMON_OPTS > $LOGFILE  2>&1 & echo $!`        if [ -z $PID ]; then            printf %s\n Fail        else            echo $PID > $PIDFILE            printf %s\n Ok        fi;;
Service start fails after Capistrano2 deploy task
python;init.d