Installation von Tiny Tiny RSS/Start-Stop-Skript
Aus Synology Wiki
Dies ist die aktuellste Version dieser Seite. Sie hat keine bestätigte Version.
#!/bin/sh # # starts "Tiny Tiny RSS"ses update daemon # put it into /usr/local/etc/rc.d/ with the suffix .sh # chmod 755 on it PHP="/usr/bin/php" # This must be changed to the directory you installed Tiny Tiny RSS into. TTRSS_DIR=/var/services/web/tt-rss # If you need more logging information, remove --quiet. DAMON_OPTS=--quiet WEBUSER=http #nobody for DSM 4.x # If you need logging information, you can change LOGFILE to another file. # It must be writable by the user $WEBUSER. LOGFILE=/dev/null DM_CMD="$PHP ${TTRSS_DIR}/update.php --daemon $DAMON_OPTS" getPID () { ps w|grep "$DM_CMD"|grep -v grep|awk '{print $1}' return $? } start_daemon () { su -m $WEBUSER -c "(trap '' SIGHUP && $DM_CMD >> $LOGFILE 2>&1) &" local RES=$? if [ $RES -eq 0 ]; then echo "`date` - Started daemon" >> "$LOG" fi return $RES } # It is VERY important that the tabs in the next line are preserved! cronLine="* * * * * root "`realpath $0`" cron" case $1 in start) start_daemon if [ $? -ne 0 ]; then echo "$cronLine" >> /etc/crontab synoservicectl --reload crond fi ;; stop) kill `getPID` if [ $? -eq 0 ]; then echo "`date` - Stopped daemon" >> "$LOG" fi ;; cron) start_daemon if [ $? -eq 0 ]; then sed -i -e "\\%$cronLine% d" /etc/crontab synoservicectl --reload crond fi ;; status) if [ -z `getPID` ]; then echo "daemon is not running." else echo "daemon is running." fi ;; *) echo "Wrong argument. Usage: $0 start|stop|status" ;; esac