🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: rocksolid.shared.helpdesk
3 messages
3 total messages Started by Guest Mon, 13 Apr 2020 16:18
Problem with cronjob
#82
Author: Guest
Date: Mon, 13 Apr 2020 16:18
10 lines
616 bytes
I have a cronjob under /etc/cron.d/test on a Debain Stretch system, which is supposed to launch a php script with the rights of the webserver.
This is the content:

*/5 * * * * /bin/su - www-data -s /bin/bash -c '/usr/bin/php /var/www/php/test.php'

So this is supposed to run every 5 minutes. The line itself on the cli does exactly what it should (so:
/bin/su - www-data -s /bin/bash -c '/usr/bin/php /var/spool/news/diym/diym/php/test.php'
 starts the script like it should). All the files are in place and accessible for the webserver.

But the cronjob does exactly nothing. wtf ? what do i miss ?
Posted on def3
Re: Problem with cronjob
#83
Author: Retro Guy@rsligh
Date: Tue, 14 Apr 2020 00:08
24 lines
963 bytes
Guest wrote:

> I have a cronjob under /etc/cron.d/test on a Debain Stretch system, which is supposed to launch a php script with the rights of the webserver.
> This is the content:

> */5 * * * * /bin/su - www-data -s /bin/bash -c '/usr/bin/php /var/www/php/test.php'

> So this is supposed to run every 5 minutes. The line itself on the cli does exactly what it should (so:
> /bin/su - www-data -s /bin/bash -c '/usr/bin/php /var/spool/news/diym/diym/php/test.php'
>  starts the script like it should). All the files are in place and accessible for the webserver.

> But the cronjob does exactly nothing. wtf ? what do i miss ?
> Posted on def3

You might try '-l' to bash to "Make bash act as if it had been invoked as a login shell", so:

*/5 * * * * /bin/su - www-data -s /bin/bash -lc '/usr/bin/php /var/www/php/test.php'

This should provide the same environment as running from the command line.

Retro Guy

--
Posted on: Rocksolid Light
news.novabbs.com
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads