Installation von Tiny Tiny RSS/Start-Stop-Skript: Unterschied zwischen den Versionen

Aus
(Ausgelagert)
 
K (cron, --daemon)
Zeile 9: Zeile 9:
getPID ()
getPID ()
{
{
ps|grep "/usr/bin/php $TTRSS_PATH/update.php -daemon"|grep -v grep|awk '{print $1}'
ps|grep "/usr/bin/php $TTRSS_PATH/update.php --daemon"|grep -v grep|awk '{print $1}'
return $?
return $?
}
}
Zeile 17: Zeile 17:
return $?
return $?
}  
}  
reset_crond () {
ps |grep /usr/sbin/crond|grep -v grep|awk '{print $1}'|xargs kill -HUP
return $?
}


cronLine="* * * * * root "`realpath $0`" cron"
cronLine="* * * * * root "`realpath $0`" cron"
Zeile 26: Zeile 31:
if [ -z "$stat" ]; then
if [ -z "$stat" ]; then
echo "$cronLine" >> /etc/crontab
echo "$cronLine" >> /etc/crontab
/usr/syno/etc/rc.d/S04crond.sh stop
reset_crond
/usr/syno/etc/rc.d/S04crond.sh start
fi
fi
;;
;;
Zeile 39: Zeile 43:
fi
fi
sed -i -e "\\%$cronLine% d" /etc/crontab
sed -i -e "\\%$cronLine% d" /etc/crontab
/usr/syno/etc/rc.d/S04crond.sh stop
reset_crond
/usr/syno/etc/rc.d/S04crond.sh start
;;
;;
*)
*)

Version vom 6. April 2013, 11:14 Uhr

#!/bin/sh
#
# starts "Tiny Tiny Rss"ses update daemon
# put it into /usr/local/etc/rc.d/
# chmod 755 on it

TTRSS_PATH=/var/services/web/ttrss
getPID ()
{
	ps|grep "/usr/bin/php $TTRSS_PATH/update.php --daemon"|grep -v grep|awk '{print $1}'
	return $?
}

start_daemon () {
	su -m nobody -c "(trap '' SIGHUP SIGINT SIGQUIT && /usr/bin/php $TTRSS_PATH/update.php --daemon >> /dev/null 2>&1) &"
	return $?
} 

reset_crond () {
	ps |grep /usr/sbin/crond|grep -v grep|awk '{print $1}'|xargs kill -HUP
	return $?
}

cronLine="*	*	*	*	*	root	"`realpath $0`" cron"

case $1 in
start)
	start_daemon
	stat=`getPID`
	if [ -z "$stat" ]; then
		echo "$cronLine" >> /etc/crontab
		reset_crond
	fi
	;;
stop)
	kill `getPID`
	;;
cron)
	stat=`getPID`
	if [ -z "$stat" ]; then
		start_daemon
	fi
	sed -i -e "\\%$cronLine% d" /etc/crontab
	reset_crond
	;;
*)
	echo "Wrong argument. Usage: $0 start|stop"
	;;
esac