Ubuntu 12.04 updater start/stop script Howto

Howtos, instructions and links to related software. Do not ask questions here.
johannes
Bear Rating Trainee
Bear Rating Trainee
Posts: 2
Joined: 17 Jun 2013, 21:58

Ubuntu 12.04 updater start/stop script Howto

Postby johannes » 17 Jun 2013, 22:11

This is a quick howto. This works for me. I'm using a ubuntu 12.04 server instance and I wanted to have an easy upstart start/stop script

OS: Ubuntu 12.04 LTS
Apache2, php5

After installation of tt-rss create a user:

Code: Select all

adduser ttrssuser


Test if your user has the rights to run the updater:

Code: Select all

su ttrssuser
cd /<your-web-root>/tt-rss/
php ./update.php --daemon


Repair all rights:

Code: Select all

exit


create ttrss.conf file in /etc/init/

Code: Select all

vi /etc/init/ttrss.conf

Paste following code into that file:

Code: Select all

description "tt-rss_updater"
author      "johannes"

start on (local-filesystems and net-device-up)
stop on runlevel [!2345]

respawn
respawn limit 99 5

chdir /var/www/tt-rss

script
    # We found $HOME is needed. Without it, we ran into problems
    export HOME="/home/ttrssuser"
    exec sudo -u ttrssuser /usr/bin/php ./update.php --daemon 2>&1 >> /var/log/ttrssupdater.log
end script

post-start script
    echo "tt-rss updater has started!"
end script


make file executable

Code: Select all

chmod +x  /etc/init/ttrss.conf


Now you can start your daemon like this

Code: Select all

service ttrss start


Hope this helps, someone.
J.

Return to “Knowledge Base”

Who is online

Users browsing this forum: No registered users and 1 guest