Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] Apache + owncloud
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
ROGA
Tux's lil' helper
Tux's lil' helper


Joined: 17 Feb 2018
Posts: 106
Location: Zurich, Switzerland

PostPosted: Sat Oct 05, 2019 12:04 pm    Post subject: [SOLVED] Apache + owncloud Reply with quote

Hi,

I've installed gentoo with apache, mysql and owncloud. In the settings of owncloud they recommended to use cron instead of ajax or webcron.

For this I have to define a cronjob, which then starts a PHP file /var/www/owncloud/cron.php regularly. In the example of owncloud this looks like this:

Code:
  # crontab -u www-data -e
 * * * * * / usr / bin / php -f /path/to/your/owncloud/cron.php


Since my gentoo uses systemd and therefore it isn't necessary to have a cron installed because there is a system-timer instead to make this job. I wrote a Timer like this that runs the script every minutes:


Code:
[Unit]
Description=Timer: OwnCloud Wartungsarbeiten alle 1 Minuten durchführen

[Timer]
OnCalendar= *-*-* *:*:00
Persistent=true
Unit=owncloud-cronjob.service

[Install]
WantedBy=timers.target


and also a corresponding service script like this:

Code:
[Unit]
Description=Service: Startet das Script cron.php um regelmässige Owncloud-Wartungsarbeiten auszuführen

[Service]
User=apache
ExecStart=/usr/bin/php7.2 -f /var/www/owncloud/cron.php


after that, I enabled and started the timer:

Code:
systemctl enable owncloud-cronjob.timer


It work's fin, but my journalctl -r shows me errors:

Code:
-- Logs begin at Sat 2019-06-01 13:10:31 CEST, end at Sat 2019-10-05 13:32:04 CEST. --
Okt 05 13:32:04 cloud systemd[1]: owncloud-cronjob.service: Failed with result 'exit-code'.
Okt 05 13:32:04 cloud systemd[1]: owncloud-cronjob.service: Main process exited, code=exited, status=203/EXEC
Okt 05 13:32:04 cloud systemd[9497]: owncloud-cronjob.service: Failed at step EXEC spawning /var/www/owncloud/cron.php: Permission denied
Okt 05 13:32:04 cloud systemd[9497]: owncloud-cronjob.service: Failed to execute command: Permission denied
Okt 05 13:32:04 cloud systemd[1]: Started Service: Startet das Script cron.php um regelmässige Owncloud-Wartungsarbeiten auszuführen.
Okt 05 13:31:04 cloud systemd[1]: owncloud-cronjob.service: Failed with result 'exit-code'.
Okt 05 13:31:04 cloud systemd[1]: owncloud-cronjob.service: Main process exited, code=exited, status=203/EXEC
Okt 05 13:31:04 cloud systemd[9495]: owncloud-cronjob.service: Failed at step EXEC spawning /var/www/owncloud/cron.php: Permission denied
Okt 05 13:31:04 cloud systemd[9495]: owncloud-cronjob.service: Failed to execute command: Permission denied
Okt 05 13:31:04 cloud systemd[1]: Started Service: Startet das Script cron.php um regelmässige Owncloud-Wartungsarbeiten auszuführen.
Okt 05 13:30:04 cloud systemd[1]: owncloud-cronjob.service: Failed with result 'exit-code'.
Okt 05 13:30:04 cloud systemd[1]: owncloud-cronjob.service: Main process exited, code=exited, status=203/EXEC
Okt 05 13:30:04 cloud systemd[9494]: owncloud-cronjob.service: Failed at step EXEC spawning /var/www/owncloud/cron.php: Permission denied
Okt 05 13:30:04 cloud systemd[9494]: owncloud-cronjob.service: Failed to execute command: Permission denied



Can anybody explain me, why the user apache don't have permission to execute the cron.php script?

Please help me, thanks!
_________________
regards,

Roland


Last edited by ROGA on Sun Oct 06, 2019 1:29 pm; edited 1 time in total
Back to top
View user's profile Send private message
forrestfunk81
Guru
Guru


Joined: 07 Feb 2006
Posts: 504
Location: münchen.de

PostPosted: Sun Oct 06, 2019 12:27 pm    Post subject: Reply with quote

Hi ROGA,

what are the script's permissions?
Code:
ls -al /var/www/owncloud/cron.php

_________________
# cd /pub/
# more beer
Back to top
View user's profile Send private message
ROGA
Tux's lil' helper
Tux's lil' helper


Joined: 17 Feb 2018
Posts: 106
Location: Zurich, Switzerland

PostPosted: Sun Oct 06, 2019 1:29 pm    Post subject: Reply with quote

Hi forrestfunk81,

thank's for your reply.

The owner of the script is apache and the permissions was 644 but in the meentime I changed my cloud from ownCloud to NextCloud, what's a fork from the ownCloud is.

The settings in the NextCloud are more or less the same but with NextCloud, my Timer-Script works without problems!

I don't know where I have made a mistake but I'm happy that now all works fine!

Thank's anyway for your time.
_________________
regards,

Roland
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum