Here is the /etc/init.d/xyz script
http://pastebin.com/02G5tpgH
Whenever the service is stopped and started via the Capistrano2, the service will not start. The Capistrano2 uses a user that have the sudo access. This is what it returns while checking the service status.
Process dead but pidfile exists
For some reason the start script is not starting the service/daemon. Below is the start script (from the
http://pastebin.com/02G5tpgH )
PHP Code:
DIR=/opt/mount/xyz/current/src
DAEMON=$DIR/main.py
DAEMON_NAME=xyz
PYTHON=/usr/local/bin/python2.7
DAEMON_OPTS="--port=8080 --debug --log_file_prefix=/opt/mount/xyz/logs/xyz --log_file_max_size=1000000 --env=stage"
DAEMON_USER=python
LOGFILE="/opt/mount/xyz/logs/error.log"
LOGPATH=$(dirname $LOGFILE)
PIDFILE=/var/run/$DAEMON_NAME.pid
case "$1" in
start)
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
;;
Everything works just find, if i have to go in and execute
PHP Code:
service xyz stop
service xyz start
service xyz status