Cron jobs on PartKeepr 1.1.0, Debian 8, PHP 7.0

616 views
Skip to first unread message

fog...@gmail.com

unread,
Mar 1, 2017, 6:47:58 AM3/1/17
to PartKeepr Users
I'm having issues with the cron jobs running. I've set up the cron job as per the instructions:

  • 0 0,6,12,18 * * * admin /usr/bin/php /var/www/partkeepr-1.1.0/app/console partkeepr:cron:run

I've also tried this:

  • 0 0,6,12,18 * * * admin /usr/bin/php7.0 /var/www/partkeepr-1.1.0/app/console partkeepr:cron:run

but every time I log in, I get a message about the synctips cronjob not running. 
I've enabled cron logger in rsyslog.conf, but it doesn't get populated with anything.

I've tried running the following manually:

  • php app/console partkeepr:cron:synctips
  • php7.0 app/console partkeepr:cron:synctips

Then I get an error message as below:
                                                                                                         
  [Symfony\Component\Debug\Exception\ContextErrorException]                                              
  Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known  

/var/log/cron.log isn't created.

Running "tail -f /var/log/syslog" is generating a lot of partkeepr avahi-daemon[467] Invalid response packets from local network addresses..

/end rant

Any ideas?
                                                                                                      

Felicia Hummel

unread,
Mar 1, 2017, 7:33:17 AM3/1/17
to partkee...@googlegroups.com
> * [Symfony\Component\Debug\Exception\ContextErrorException]
> *
> * Warning: file_get_contents(): php_network_getaddresses: getaddrinfo
> failed: Name or service not known *

This indicated that your DNS resolution is not working properly. Try to do

ping partkeepr.org

if it doesn't work, you need to setup your DNS resolver properly.

cheers
Felicia

fog...@gmail.com

unread,
Mar 1, 2017, 7:58:42 AM3/1/17
to PartKeepr Users, fel...@drachenkatze.org
Well, it's running on a standalone network, so that's why.. :) 

What's the function of the console? Checking for updates? Is the cron job essential for maintaining Partkeepr?

Felicia Hummel

unread,
Mar 1, 2017, 8:01:42 AM3/1/17
to partkee...@googlegroups.com
On 03/01/2017 01:58 PM, fog...@gmail.com wrote:
> Well, it's running on a standalone network, so that's why.. :)
>
> What's the function of the console? Checking for updates? Is the cron
> job essential for maintaining Partkeepr?

No, synctips just syncronizes all tips from the PartKeepr Wiki to your
local installation.

You can disable cronjob checking in your parameters.php like so:

$container->setParameter('partkeepr.cronjob.check', false);

Re-run setup after you have changed the file.

cheers
Felicia

fog...@gmail.com

unread,
Mar 1, 2017, 8:11:10 AM3/1/17
to PartKeepr Users, fel...@drachenkatze.org
Ah, thanks!

Nathan Hartman

unread,
May 2, 2018, 9:41:52 AM5/2/18
to PartKeepr Users
On Wednesday, March 1, 2017 at 6:47:58 AM UTC-5, fog...@gmail.com wrote:
I'm having issues with the cron jobs running. I've set up the cron job as per the instructions:

  • 0 0,6,12,18 * * * admin /usr/bin/php /var/www/partkeepr-1.1.0/app/console partkeepr:cron:run

I've also tried this:

  • 0 0,6,12,18 * * * admin /usr/bin/php7.0 /var/www/partkeepr-1.1.0/app/console partkeepr:cron:run

but every time I log in, I get a message about the synctips cronjob not running. 
I've enabled cron logger in rsyslog.conf, but it doesn't get populated with anything.

Does anyone know why the cron job doesn't run when the above incantation is placed in /etc/cron.d/partkeepr on Debian? Does anyone see an obvious mistake in the format of the above line? Is there some kind of permission or other setup issue that needs to be looked at?

I have Debian "Stretch" with PartKeepr 1.3.0 and I used the procedure documented here to set up PartKeepr:

Everything works great except that PartKeepr complains the cron job isn't running, at each login.

Felicia Hummel

unread,
May 2, 2018, 9:51:43 AM5/2/18
to partkee...@googlegroups.com
On Wed, 2018-05-02 at 06:41 -0700, Nathan Hartman wrote:
> On Wednesday, March 1, 2017 at 6:47:58 AM UTC-5, fog...@gmail.com
> wrote:
> > I'm having issues with the cron jobs running. I've set up the cron
> > job as per the instructions:
> >
> > 0 0,6,12,18 * * * admin /usr/bin/php /var/www/partkeepr-
> > 1.1.0/app/console partkeepr:cron:run
> >
> > I've also tried this:
> >
> > 0 0,6,12,18 * * * admin /usr/bin/php7.0 /var/www/partkeepr-
> > 1.1.0/app/console partkeepr:cron:run
> >
> > but every time I log in, I get a message about the synctips cronjob
> > not running. I've enabled cron logger in rsyslog.conf, but it
> > doesn't get populated with anything.
> >
>

Try to run it manually as the user you specified in the cronjob. If it
works, then the messages should go away. However, "admin" is an unusual
name for the webserver user; remember that you have to run the cronjob
as the user which the webserver runs off.

All the best
Felicia

Nathan Hartman

unread,
May 3, 2018, 4:22:32 PM5/3/18
to PartKeepr Users
On Wednesday, May 2, 2018 at 9:51:43 AM UTC-4, Felicia Hummel wrote:

Try to run it manually as the user you specified in the cronjob. If it
works, then the messages should go away. However, "admin" is an unusual
name for the webserver user; remember that you have to run the cronjob
as the user which the webserver runs off.

All the best
Felicia

It looks like I made the necessary change (admin changed to www-data) when I followed the above procedure. In /etc/cron.d/partkeepr I have:

 0 0,6,12,18 * * * www-data /usr/bin/php /var/www/partkeepr-1.3.0/app/console partkeepr:cron:run

and Apache is running as the www-data user, verified by ps aux | egrep '(apache|httpd)' and also by looking in /etc/apache2/envvars for APACHE_RUN_USER and APACHE_RUN_GROUP. Both are set to www-data.

The above file is owned by user root as required by Debian's cron.

I ran this command:

$ sudo -u www-data /usr/bin/php /var/www/partkeepr-1.3.0/app/console partkeepr:cron:run

There was no output from that command.

Any ideas?

Felicia Hummel

unread,
May 3, 2018, 4:43:19 PM5/3/18
to partkee...@googlegroups.com
> $ sudo -u www-data /usr/bin/php /var/www/partkeepr-1.3.0/app/console
> partkeepr:cron:run
>
> There was no output from that command.

It's not supposed to give any output unless there is an error. If it
would give an output, a mail would be sent each time the cron runs,
which is usually not what you want.

You should check if PartKeepr still complains about crons being not
ran. If so, please check the table CronLogger to see which crons aren't
being ran.

You can then try to run the crons manually, for example php app/console
partkeepr:cron:synctips

You can also add -vvv to the cron to see a verbose debug log what's
going on for each cron command.

All the best
Felicia
Reply all
Reply to author
Forward
0 new messages