Rocksolid Light

Welcome to Rocksolid Light

register   nodelist   faq  


rocksolid / rocksolid.shared.helpdesk / Re: Problem with cronjob

SubjectAuthor
* Problem with cronjobGuest
`* Re: Problem with cronjobRetro Guy
 `* Re: Problem with cronjobGuest
  `* Re: Problem with cronjobRetro Guy
   `* Re: Problem with cronjobGuest
    `- Re: Problem with cronjobRetro Guy

Subject: Problem with cronjob
From: guest@retrobbs.rocksolidbbs.com (Guest)
Newsgroups: rocksolid.shared.helpdesk
Organization: Dancing elephants
Date: Mon, 13 Apr 2020 20:18 UTC
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


Subject: Re: Problem with cronjob
From: Retro Guy@rslight.i2p (Retro Guy)
Newsgroups: rocksolid.shared.helpdesk
Organization: Rocksolid Light
Date: Tue, 14 Apr 2020 00:08 UTC
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


Subject: Re: Problem with cronjob
From: guest@retrobbs.rocksolidbbs.com (Guest)
Newsgroups: rocksolid.shared.helpdesk
Organization: Dancing elephants
Date: Tue, 14 Apr 2020 07:19 UTC
I tried with -lc, but the same result: nothing.
Thanks anyway.
Posted on def3


Subject: Re: Problem with cronjob
From: Retro Guy@rslight.i2p (Retro Guy)
Newsgroups: rocksolid.shared.helpdesk
Organization: Rocksolid Light
Date: Tue, 14 Apr 2020 07:55 UTC
A few other ideas:

I'm sure you thought of this, but are you running it in the crontab for root?

Does the script need to be run from it's current directory? If so, it won't work unless you change to that directory.

When you say it does 'nothing', have you checked to see if the script is executed, even though it does not perform it's tasks?  It's two different problems if it either never executes the script at all, or if the script fails to perform.

Can you post the script so others can test?

Retro Guy

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


Subject: Re: Problem with cronjob
From: guest@retrobbs.rocksolidbbs.com (Guest)
Newsgroups: rocksolid.shared.helpdesk
Organization: Dancing elephants
Date: Tue, 14 Apr 2020 11:57 UTC
ok, it it is solved. i edited directly instead of using crontab -e, and was introducing formal errors in the file, which made cron disregard it.
thanks.
Posted on def3


Subject: Re: Problem with cronjob
From: Retro Guy@rslight.i2p (Retro Guy)
Newsgroups: rocksolid.shared.helpdesk
Organization: Rocksolid Light
Date: Tue, 14 Apr 2020 23:16 UTC
Guest wrote:

ok, it it is solved. i edited directly instead of using crontab -e, and was introducing formal errors in the file, which made cron disregard it.
thanks.
Posted on def3

Nice! Glad you got it working, and thanks for posting the solution.

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


1
rocksolid light 0.6.5e
clearnet i2p tor