Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cpanel does not run my cron jobs

I have cron jobs in cPanel that are scheduled every night. Yesterday, I noticed that these cron jobs haven't run since 2 days ago. I checked the cron log in /var/log/cron, and it shows me errors when trying to access the file.

Errors:

Nov  6 11:25:01 web2 crond[17439]: (laptoplc) ERROR (failed to change user)
Nov  6 11:25:01 web2 crond[17447]: (projecto) ERROR (failed to change user)
Nov  6 11:25:01 web2 crond[17446]: (CRON) ERROR (setreuid failed): Resource temporarily unavailable
Nov  6 11:25:01 web2 crond[17446]: (laptoppa) ERROR (failed to change user)

What could be the problem?

like image 400
Alan Avatar asked Nov 06 '13 22:11

Alan


People also ask

Why does my cron job not run?

Check permissionsAnother user might have created the cron job and you may not be authorized to execute it. Note that the root must own jobs added as files in a /etc/cron. */ directory. That means that if you don't have root permissions, you might not be able to access the job.

How do I enable cron jobs in cPanel?

Configuring Cron Jobs in cPanel In cPanel, select Cron Jobs in the Advanced section of the Main Page menu. You will find a table for adding new scripts and setting their time intervals. To simplify configuration, we include a drop-down menu with common settings such as Once Per Week or Once Per Month.


2 Answers

There could be several things caused this. Here are ways to debug your crons:

  1. Run it manually from shell:

    php yourcron.php

  2. Add logging from your cron file, maybe by adding error_log('check if running'); to see if it is indeed running.

As suggested above it could be permission issue too. Add execute permission to your cron:

chmod 755 yourcron.php
like image 193
jaycode Avatar answered Sep 18 '22 06:09

jaycode


Check whether any Zombie processes for these users exist using the below command.

ps -eLF |grep -i username

Try killing those processes and check whether cronjobs are running after that.

sudo ps -eLF |grep username |awk '{print $2}' |xargs sudo kill -9 

Dont kill any important running process !

like image 38
Mohammed Yazeen CM Avatar answered Sep 22 '22 06:09

Mohammed Yazeen CM