diff --git a/apks/reddit-nextcloud-importer/APKBUILD b/apks/reddit-nextcloud-importer/APKBUILD
index d125f820cfc6791574e2d22dadc23c805679cd8d..b237645f51c755abf411d6018214ae4de790b9ed 100644
--- a/apks/reddit-nextcloud-importer/APKBUILD
+++ b/apks/reddit-nextcloud-importer/APKBUILD
@@ -45,6 +45,6 @@ }
sha512sums="
aa4274d5b904c15bf262e59fbc50de58d414f660b3e3214cd44ebab0aa2f80ed890ed5bb9190df555118d8dbec81e41553816fcffc3fe1770f347c394501910d reddit-nextcloud-importer-0.1.2.tar.gz
-718c5997338db00418c3070007c38c8fad1743e8e17e5ef3e7d25d2d40ae9474bd51edd450b854e588595cc62502a18aaa7945a2b8227a5480bb2f805a1bda1a reddit-nextcloud-importer.initd
-83695d870b1a5d6d914c268001084ba5a4a65842b5ee8243736a45810822bc493af1990a6a5ca71dfd623f932388824edb5dced8f4fefadc95c55d1513e0db93 reddit-nextcloud-importer.confd
+b7960ee63d10c792fb3302f6f84fa23975dfb1d24a85249ff612c289126297f605bc4203b28eff7f94aefb6729593d4fc22bdb78d398d7e4445f22f2b78175a0 reddit-nextcloud-importer.initd
+8e400cd0ac302b8cade98db5aea8afd109e7d5d434281238997c1e3f0b779322ecade95a26fde5860a3846b8d9687cca95df1c1b5ee0b489d6782bf6c2680666 reddit-nextcloud-importer.confd
"
diff --git a/apks/reddit-nextcloud-importer/reddit-nextcloud-importer.confd b/apks/reddit-nextcloud-importer/reddit-nextcloud-importer.confd
index d41881276485244cd4a1341d935dbd06f4a13263..c79d1bf504bb8352ad1415c46e7f971e41e08b54 100644
--- a/apks/reddit-nextcloud-importer/reddit-nextcloud-importer.confd
+++ b/apks/reddit-nextcloud-importer/reddit-nextcloud-importer.confd
@@ -5,6 +5,10 @@ reddit_password=""
nextcloud_host=""
nextcloud_username=""
nextcloud_password=""
+tmp_dir="/tmp/$RC_SVCNAME/"
+
+# for my local set I use www-data for most of my service. Change it to fit yours
+cmd_user="www-data:www-data"
# File to redirect stdout/stderr into. Set to empty string to disable.
#logfile="/var/log/$RC_SVCNAME.log"
diff --git a/apks/reddit-nextcloud-importer/reddit-nextcloud-importer.initd b/apks/reddit-nextcloud-importer/reddit-nextcloud-importer.initd
index 7b48eeb64927a7c1fc2c158ea294fcaca1f4cf88..9beed1fe5cc023d1a3b9e0087cd0e3d00d142aaa 100644
--- a/apks/reddit-nextcloud-importer/reddit-nextcloud-importer.initd
+++ b/apks/reddit-nextcloud-importer/reddit-nextcloud-importer.initd
@@ -3,15 +3,28 @@ supervisor="supervise-daemon"
name="reddit-nextcloud-importer"
command="/usr/bin/reddit-nextcloud-importer"
-command_args=" -c ${client_id} -s ${client_secret} -u ${reddit_username} -p ${reddit_password} -P ${nextcloud_password} -U ${nextcloud_username} -o ${nextcloud_host}"
+command_args="-c ${client_id}
+ -s ${client_secret}
+ -u ${reddit_username}
+ -p ${reddit_password}
+ -P ${nextcloud_password}
+ -U ${nextcloud_username}
+ -o ${nextcloud_host}
+ "
command_background="yes"
-supervise_daemon_args="--user www-data:www-data"
+supervise_daemon_args="--user $cmd_user -d $tmp_dir"
pidfile="/run/$RC_SVCNAME.pid"
output_log="$logfile"
error_log="$logfile"
+start_pre() {
+ if [ "$logfile" ]; then
+ checkpath --file --mode 0640 --owner "cmd_user" "$logfile" || return 1
+ fi
+ checkpath --directory --owner "$cmd_user" --mode 0775 "$tmp_dir" || return 1
+}
+
depend() {
use net
}
-