I searched the wiki and forum but could not find any working service script.
I finally found something that seems to work quite well.
Source: http://www.rosehosting.com/blog/how-to-set-up-tt-rss-tiny-tiny-rss-on-centos-6/
Create file "/etc/init.d/reader" and write into it:
Code: Select all
#!/bin/bash
## reader daemon
# chkconfig: 345 20 80
# description: reader update daemon
# processname: reader
# Source function library.
. /etc/init.d/functions
# Define some variables
TT_PATH="/var/www/html/tt-rss/"
DAEMON=/usr/bin/php
#DAEMONOPTS="update.php --daemon --feeds"
DAEMONOPTS="update_daemon2.php"
NAME=reader
DESC="reader update daemon"
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
USER=apache
case "$1" in
start)
printf "%-50s" "Starting $NAME..."
cd $TT_PATH
if [ ! -f $PIDFILE ]; then
daemon --user=$USER $DAEMON $DAEMONOPTS > /dev/null 2>&1 &
sleep 5
PID=`ps aux|grep -vE 'grep|runuser|bash'|grep -w '/usr/bin/php update_daemon2.php'|awk '{print $2}'`
if [ -z "$PID" ]; then
printf "%s\n" "Fail"
else
echo $PID > $PIDFILE
printf "%s\n" "Ok"
fi
fi
;;
status)
printf "%-50s" "Checking $NAME..."
if [ -f $PIDFILE ]; then
PID=`cat $PIDFILE`
if [ -z "`pgrep $PID`" ] && [ "$PID" != "`ps aux|grep -vE 'grep|runuser|bash'|grep -w '/usr/bin/php update_daemon2.php'|awk '{print $2}'`" ]; 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 $NAME"
if [ -f $PIDFILE ]; then
PID=`cat $PIDFILE`
cd $TT_PATH
kill -HUP $PID 2>/dev/null
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 1
esac
then make it executable by executing:
Code: Select all
# yum install php-process
# service httpd restart
# chmod +x /etc/init.d/reader
# chkconfig --levels 235 reader on
# service reader start