Installation von Tiny Tiny RSS/Start-Stop-Skript: Unterschied zwischen den Versionen
Aus
K (synchronisiert, effizientere Auslagerung) |
(Etwas mehr Doku in den Kommentaren (Englisch), sufix, trap verkleinert) |
||
Zeile 2: | Zeile 2: | ||
#!/bin/sh | #!/bin/sh | ||
# | # | ||
# starts "Tiny Tiny | # starts "Tiny Tiny RSS"ses update daemon | ||
# put it into /usr/local/etc/rc.d/ | # put it into /usr/local/etc/rc.d/ with the suffix .sh | ||
# chmod 755 on it | # 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" | DM_CMD="/usr/bin/php /var/services/web/ttrss/update.php --daemon" | ||
getPID () | getPID () | ||
Zeile 13: | Zeile 14: | ||
} | } | ||
# If you need logging information, you can replace /dev/null with another file. | |||
# It must be writable by the user nobody. | |||
# If you need even more logging information, remove the parameter --quiet. | |||
start_daemon () { | start_daemon () { | ||
su -m nobody -c "(trap '' SIGHUP | su -m nobody -c "(trap '' SIGHUP && $DM_CMD --quiet >> /dev/null 2>&1) &" | ||
return $? | return $? | ||
} | } | ||
Zeile 50: | Zeile 54: | ||
esac | esac | ||
</pre> | </pre> | ||
==Links== | |||
*[http://www.synology.com/support/3rd_party_app_int.php 3rd-Party Apps Developer Guide] |
Version vom 7. Juni 2013, 20:36 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 replace /dev/null with another file. # It must be writable by the user nobody. # If you need even more logging information, remove the parameter --quiet. start_daemon () { su -m nobody -c "(trap '' SIGHUP && $DM_CMD --quiet >> /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) echo `getPID`|xargs kill ;; 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