Skip to content

Commit

Permalink
README.rst: Update OpenRC script
Browse files Browse the repository at this point in the history
Use variables, depend on revelant services and add start_pre()
to check paths automatically.

Signed-off-by: Raymond Hackley <[email protected]>
  • Loading branch information
wonderfulShrineMaidenOfParadise committed Aug 19, 2022
1 parent 4603ee1 commit f1b7313
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -267,20 +267,31 @@ On Alpine/postmarketOS/Gentoo/Artix or the other OpenRC based distros, you can c
description="Nextcloud News Updater Daemon"
pidfile=${pidfile:-/run/nextcloud-news-updater.pid}
output_log="/var/log/nextcloud-news-updater/output.log"
error_log="/var/log/nextcloud-news-updater/error.log"
log_directory="/var/log/$RC_SVCNAME"
pidfile=${pidfile:-/run/$RC_SVCNAME.pid}
output_log="${output_log:-$log_directory/output.log}"
error_log="${error_log:-$log_directory/error.log}"
config_file="/etc/$RC_SVCNAME/updater.ini"
command=${command:-/usr/bin/nextcloud-news-updater}
command_user=${command_user:-www-data:www-data}
command_args="-c /etc/nextcloud/news/updater.ini"
command_args="-c $config_file"
command_background=true
depend() {
need net
use mariadb postgresql
}
start_pre() {
checkpath --directory --owner $command_user "$log_directory"
checkpath --file --owner $command_user "$output_log" "$error_log"
checkpath --directory "/etc/$RC_SVCNAME"
checkpath --file --mode 0600 --owner $command_user "$config_file"
}
Then to enable and start it run::

sudo -u www-data mkdir /var/log/nextcloud-news-updater
sudo -u www-data touch /var/log/nextcloud-news-updater/output.log \
/var/log/nextcloud-news-updater/error.log
sudo chmod 755 /etc/init.d/nextcloud-news-updater
sudo rc-update add nextcloud-news-updater
sudo rc-service nextcloud-news-updater start
Expand Down

0 comments on commit f1b7313

Please sign in to comment.