Remove old files and explain how to use systemd

This commit is contained in:
Bernhard Posselt 2016-04-03 21:15:24 +02:00
Родитель 749beecbaa
Коммит c57c5a2b6e
5 изменённых файлов: 42 добавлений и 79 удалений

Просмотреть файл

@ -1 +1 @@
include README.rst CHANGELOG.rst requirements.txt LICENSE.txt example-config.ini owncloud_news_updater/version.txt include README.rst CHANGELOG.rst requirements.txt LICENSE.txt owncloud_news_updater/version.txt

Просмотреть файл

@ -44,7 +44,7 @@ There are two different ways to install the updater:
* Manual installation * Manual installation
* No installation * No installation
Installation using pip Installation Using Pip
~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~
Since 8.2 the package is available on pypi for installation via pip (the Since 8.2 the package is available on pypi for installation via pip (the
Python library package manager). Python library package manager).
@ -67,7 +67,7 @@ To uninstall the library run::
sudo pip3 uninstall owncloud_news_updater sudo pip3 uninstall owncloud_news_updater
Manual installation Manual Installation
~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~
If you don't want to install the updater via pip, you can install it manually. If you don't want to install the updater via pip, you can install it manually.
This requires setuptools to be installed. On Ubuntu this can be done by running:: This requires setuptools to be installed. On Ubuntu this can be done by running::
@ -82,7 +82,7 @@ To uninstall the updater run::
python3 setup.py uninstall python3 setup.py uninstall
No installation No Installation
~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~
If you do not want to install the script at all you can call it directly. This If you do not want to install the script at all you can call it directly. This
however requires the requests module to be installed. To do that however requires the requests module to be installed. To do that
@ -181,19 +181,51 @@ Then run the updater with::
owncloud-news-updater -c /path/to/config owncloud-news-updater -c /path/to/config
Running the updater as systemd service Running The Updater As Systemd Service
-------------------------------------- --------------------------------------
Since almost always you want to run and stop the updater using your in init system, Since almost always you want to run and stop the updater using your in init system,
the updater contains a simple example SystemD service file in you can create a very simple unit file. To do that, simply create a text file
**systemd/owncloud-news-updater.service**. To install it, copy the file into the in **/etc/systemd/system/owncloud-news-updater.service** with the following contents
**/etc/systemd/system/** folder and run::
.. code:: ini
[Unit]
After=default.target
[Service]
Type=simple
User=http
ExecStart=/usr/bin/owncloud-news-updater -c /etc/owncloud/news/updater.ini
[Install]
WantedBy=default.target
Then to enable and start it run::
systemctl enable owncloud-news-updater.service systemctl enable owncloud-news-updater.service
systemctl start owncloud-news-updater.service systemctl start owncloud-news-updater.service
The service file will assume that your configuration is located in **/etc/owncloud/news/updater.ini** **Note**: If you are using the cli based updater (as in set an absolute directory as url)
you need to set the webserver user as user in the unit file since ownCloud requires
every call to it's cli to be executed as the user that owns it. This user
varies from distribution to distribution. In Debian and Ubuntu you would use the
**www-data** user:
Self signed certificates .. code:: ini
[Unit]
After=default.target
[Service]
Type=simple
User=www-data
ExecStart=/usr/bin/owncloud-news-updater -c /etc/owncloud/news/updater.ini
[Install]
WantedBy=default.target
Self Signed Certificates
------------------------ ------------------------
Should you use a self signed certificate over SSL, first consider getting a Should you use a self signed certificate over SSL, first consider getting a

Просмотреть файл

@ -1,11 +0,0 @@
# all values are optional and can be left out to require the argument being
# passed in from the command line
[updater]
user = admin
password = admin
threads = 10
interval = 900
loglevel = error
testrun = false
url = http://localhost/owncloud

Просмотреть файл

@ -1,48 +0,0 @@
# Copyright (c) 2014 Bernhard Posselt <dev@bernhard-posselt.com>
Name: owncloud-news-updater
Version: 4.3.2
Release: 0
Url: https://github.com/owncloud/news/tree/master/bin/updater
Summary: A fast, deadlock free ownCloud News feed updater
License: AGPL-3.0
Group: Productivity/Networking/Web/Utilities
Source: https://github.com/owncloud/news/tree/master/bin/updater
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: pkgconfig(systemd)
BuildRequires: python3-devel
BuildRequires: python3-setuptools
Requires: python3 >= 3.2
Requires: python3-requests
BuildArch: noarch
%description
ownCloud does not require people to install threading or multiprocessing libraries. Because the feed update process is mainly limited by I/O, parallell fetching of RSS feed updates can speed up the updating process significantly. In addition the cronjob can get into a deadlock (https://github.com/owncloud/core/issues/3221) which will cause the updater to get stuck resulting in your feeds not to being updated anymore. This can be solved by using a script that uses the updater API: https://github.com/owncloud/news/wiki/Cron-1.2
%prep
%setup -q -n %{name}-%{version}
%build
python setup.py build
%install
python setup.py install --prefix=%{_prefix} --install-scripts=/usr/bin
mkdir -p /etc/owncloud/news
install -D -m 0644 %{buildroot}/example-config.ini /etc/owncloud/news/updater.ini
install -D -m 0644 %{buildroot}/systemd/owncloud-news-updater.service %{_unitdir}
%pre
%service_add_pre %{name}.service
%post
%service_add_post %{name}.service
%preun
%service_del_preun %{name}.service
%postun
%service_del_postun %{name}.service
%files
%config %attr(0644,root,root) /etc/owncloud/news/updater.ini

Просмотреть файл

@ -1,10 +0,0 @@
[Unit]
After=default.target
[Service]
Type=simple
User=nobody
ExecStart=/usr/bin/owncloud-news-updater -c /etc/owncloud/news/updater.ini
[Install]
WantedBy=default.target