Rocksolid Light

Welcome to novaBBS

register   nodelist   faq  

Your account also provides newsreader access to all groups at news.i2pn2.org port 119 or 563 (TLS)


rocksolid / 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

1
Subject: Problem with cronjob
From: gue...@retrobbs.rocksolidbbs.com (Guest)
Newsgroups: rocksolid.shared.helpdesk
Organization: Dancing elephants
Date: Mon, 13 Apr 2020 20:18 UTC
Path: i2pn2.org!.POSTED!not-for-mail
From: Guest <guest@retrobbs.rocksolidbbs.com>
Newsgroups: rocksolid.shared.helpdesk
Subject: Problem with cronjob
Date: Mon, 13 Apr 2020 16:18:04 -0400
Organization: Dancing elephants
Lines: 9
Message-ID: <r72hb3$88r$1@i2pn2.org>
Reply-To: Guest <guest@retrobbs.rocksolidbbs.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 13 Apr 2020 20:16:36 -0000 (UTC)
Injection-Info: i2pn2.org; posting-account="def.i2p";
logging-data="8475"; mail-complaints-to="usenet@i2pn2.org"
User-Agent: FUDforum 3.0.7
X-FUDforum: 6666cd76f96956469e7be39d750cc7d9 <102041>
Xref: rslight2 rocksolid.shared.helpdesk:77
Message-ID: <r72hb3$88r$1@i2pn2.org>
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 ...@rslight.i2p (Retro Guy)
Newsgroups: rocksolid.shared.helpdesk
Organization: Rocksolid Light
Date: Tue, 14 Apr 2020 00:08 UTC
Path: i2pn2.org!.POSTED!not-for-mail
From: Retro Guy@rslight.i2p (Retro Guy)
Newsgroups: rocksolid.shared.helpdesk
Subject: Re: Problem with cronjob
Date: Tue, 14 Apr 2020 00:08:01 -0000 (UTC)
Organization: Rocksolid Light
Message-ID: <8eb7e200f396ae978dd6b48fb99e456a$1@news.novabbs.com>
References: <r72hb3$88r$1@i2pn2.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 14 Apr 2020 00:08:01 -0000 (UTC)
Injection-Info: i2pn2.org; posting-account="retrobbs1";
logging-data="6414"; mail-complaints-to="usenet@i2pn2.org"
User-Agent: Rocksolid Light (news.novabbs.com/getrslight)
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on novabbs.com
X-Rslight-Site: $2y$10$CzkctrC03Cw3nS7PjM.WvuT2ATEx6G4ZijbkBtgcFHgv4Nybv49kW
Xref: rslight2 rocksolid.shared.helpdesk:78
Message-ID: <8eb7e200f396ae978dd6b48fb99e456a$1@news.novabbs.com>
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: gue...@retrobbs.rocksolidbbs.com (Guest)
Newsgroups: rocksolid.shared.helpdesk
Organization: Dancing elephants
Date: Tue, 14 Apr 2020 07:19 UTC
Path: i2pn2.org!.POSTED!not-for-mail
From: Guest <guest@retrobbs.rocksolidbbs.com>
Newsgroups: rocksolid.shared.helpdesk
Subject: Re: Problem with cronjob
Date: Tue, 14 Apr 2020 03:19:07 -0400
Organization: Dancing elephants
Lines: 1
Message-ID: <r73o2g$oju$1@i2pn2.org>
References: <8eb7e200f396ae978dd6b48fb99e456a$1@news.novabbs.com>
Reply-To: Guest <guest@retrobbs.rocksolidbbs.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 14 Apr 2020 07:17:37 -0000 (UTC)
Injection-Info: i2pn2.org; posting-account="def.i2p";
logging-data="25214"; mail-complaints-to="usenet@i2pn2.org"
User-Agent: FUDforum 3.0.7
X-FUDforum: 6666cd76f96956469e7be39d750cc7d9 <102048>
Xref: rslight2 rocksolid.shared.helpdesk:79
Message-ID: <r73o2g$oju$1@i2pn2.org>
I tried with -lc, but the same result: nothing.
Thanks anyway.
Posted on def3


Subject: Re: Problem with cronjob
From: Retro ...@rslight.i2p (Retro Guy)
Newsgroups: rocksolid.shared.helpdesk
Organization: Rocksolid Light
Date: Tue, 14 Apr 2020 07:55 UTC
Path: i2pn2.org!.POSTED!not-for-mail
From: Retro Guy@rslight.i2p (Retro Guy)
Newsgroups: rocksolid.shared.helpdesk
Subject: Re: Problem with cronjob
Date: Tue, 14 Apr 2020 07:55:02 -0000 (UTC)
Organization: Rocksolid Light
Message-ID: <84a557c77d4042b9002723fa6ba464a6$1@news.novabbs.com>
References: <8eb7e200f396ae978dd6b48fb99e456a$1@news.novabbs.com> <r73o2g$oju$1@i2pn2.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 14 Apr 2020 07:55:02 -0000 (UTC)
Injection-Info: i2pn2.org; posting-account="retrobbs1";
logging-data="30298"; mail-complaints-to="usenet@i2pn2.org"
User-Agent: Rocksolid Light (news.novabbs.com/getrslight)
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on novabbs.com
X-Rslight-Site: $2y$10$ZcB26h.ixNsI7vsS2X1zn.Wk4yp1j9mJnfcgSYdNMrSPeG0VZNpOG
Xref: rslight2 rocksolid.shared.helpdesk:80
Message-ID: <84a557c77d4042b9002723fa6ba464a6$1@news.novabbs.com>
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: gue...@retrobbs.rocksolidbbs.com (Guest)
Newsgroups: rocksolid.shared.helpdesk
Organization: Dancing elephants
Date: Tue, 14 Apr 2020 11:57 UTC
Path: i2pn2.org!.POSTED!not-for-mail
From: Guest <guest@retrobbs.rocksolidbbs.com>
Newsgroups: rocksolid.shared.helpdesk
Subject: Re: Problem with cronjob
Date: Tue, 14 Apr 2020 07:57:44 -0400
Organization: Dancing elephants
Lines: 1
Message-ID: <r748ct$vbe$1@i2pn2.org>
References: <84a557c77d4042b9002723fa6ba464a6$1@news.novabbs.com>
Reply-To: Guest <guest@retrobbs.rocksolidbbs.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 14 Apr 2020 11:56:15 -0000 (UTC)
Injection-Info: i2pn2.org; posting-account="def.i2p";
logging-data="32110"; mail-complaints-to="usenet@i2pn2.org"
User-Agent: FUDforum 3.0.7
X-FUDforum: 6666cd76f96956469e7be39d750cc7d9 <102050>
Xref: rslight2 rocksolid.shared.helpdesk:81
Message-ID: <r748ct$vbe$1@i2pn2.org>
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 ...@rslight.i2p (Retro Guy)
Newsgroups: rocksolid.shared.helpdesk
Organization: Rocksolid Light
Date: Tue, 14 Apr 2020 23:16 UTC
Path: i2pn2.org!.POSTED!not-for-mail
From: Retro Guy@rslight.i2p (Retro Guy)
Newsgroups: rocksolid.shared.helpdesk
Subject: Re: Problem with cronjob
Date: Tue, 14 Apr 2020 23:16:01 -0000 (UTC)
Organization: Rocksolid Light
Message-ID: <46abfb50db9a90d6972060a070b0369a$1@news.novabbs.com>
References: <84a557c77d4042b9002723fa6ba464a6$1@news.novabbs.com> <r748ct$vbe$1@i2pn2.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 14 Apr 2020 23:16:01 -0000 (UTC)
Injection-Info: i2pn2.org; posting-account="retrobbs1";
logging-data="3230"; mail-complaints-to="usenet@i2pn2.org"
User-Agent: Rocksolid Light (news.novabbs.com/getrslight)
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on novabbs.com
X-Rslight-Site: $2y$10$2khGE45C9LFFh0CnfWiquuSE8t/E3avSoGiAMfhz9SsaswU7wsV5O
Xref: rslight2 rocksolid.shared.helpdesk:82
Message-ID: <46abfb50db9a90d6972060a070b0369a$1@news.novabbs.com>
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.6
clearnet i2p tor