Installation von Tiny Tiny RSS/Start-Stop-Skript: Unterschied zwischen den Versionen
Aus
KKeine Bearbeitungszusammenfassung |
K (auf DSM 5 angepasst) |
||
Zeile 19: | Zeile 19: | ||
LOGFILE=/dev/null | LOGFILE=/dev/null | ||
start_daemon () { | start_daemon () { | ||
su -m | su -m http -c "(trap '' SIGHUP && $DM_CMD --quiet >> $LOGFILE 2>&1) &" | ||
return $? | return $? | ||
} | } | ||
Zeile 28: | Zeile 28: | ||
} | } | ||
# It is | # It is VERY important that the tabs in the next line are preserved! | ||
cronLine="* * * * * root "`realpath $0`" cron" | cronLine="* * * * * root "`realpath $0`" cron" | ||
Zeile 51: | Zeile 51: | ||
sed -i -e "\\%$cronLine% d" /etc/crontab | sed -i -e "\\%$cronLine% d" /etc/crontab | ||
reset_crond | reset_crond | ||
;; | |||
status) | |||
stat=`getPID` | |||
if [ -z "$stat" ]; then | |||
echo "daemon is not running." | |||
else | |||
echo "daemon is running." | |||
fi | |||
;; | ;; | ||
*) | *) | ||
echo "Wrong argument. Usage: $0 start|stop" | echo "Wrong argument. Usage: $0 start|stop|status" | ||
;; | ;; | ||
esac | esac |
Version vom 11. April 2014, 14:23 Uhr
#!/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 # Here, /var/services/web/ttrss/ must be changed to the directory that you installed Tiny Tiny RSS into DM_CMD="/usr/bin/php /var/services/web/ttrss/update.php --daemon" getPID () { ps|grep "$DM_CMD"|grep -v grep|awk '{print $1}' return $? } # If you need logging information, you can change LOGFILE to another file. # It must be writable by the user nobody. # If you need some sensible logging information, remove the parameter --quiet. LOGFILE=/dev/null start_daemon () { su -m http -c "(trap '' SIGHUP && $DM_CMD --quiet >> $LOGFILE 2>&1) &" return $? } reset_crond () { ps |grep /usr/sbin/crond|grep -v grep|awk '{print $1}'|xargs kill -HUP return $? } # It is VERY important that the tabs in the next line are preserved! 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) PID=`getPID` kill $PID ;; cron) stat=`getPID` if [ -z "$stat" ]; then start_daemon fi sed -i -e "\\%$cronLine% d" /etc/crontab reset_crond ;; status) stat=`getPID` if [ -z "$stat" ]; then echo "daemon is not running." else echo "daemon is running." fi ;; *) echo "Wrong argument. Usage: $0 start|stop|status" ;; esac