Author Topic: Crontab only works manually by clicking on the 'Run'  (Read 12307 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
Crontab only works manually by clicking on the 'Run'
« on: January 29, 2019, 03:57:10 PM »
I runing Mautic on Centos web panel 7, but cronjob is not working.
I'll give an example.

This is one of the commands I'm using. This command updates the MaxMind - GeoLite 2 database on Mautic.
Code: [Select]
* * * * * php /home/user/public_html/mautic/app/console mautic:iplookup:download
I made him do the update every minute to get feedback if it was working, but the commands only work if I run manually (on the 'run' button). I would like the action to work automatically, as it is to be.

I already tried to put the user who will execute the command:
Code: [Select]
* * * * * user php /home/user/public_html/mautic/app/console mautic:iplookup:downloadbut that way it does not work even in the manual. 'Run'

I've already tried to fix user permissions, but I did not succeed.

What I found strange is that in the log shows in the exact minutes the actions being called, but it has no effect on the Mautic.
Command: tail -n 20 /var/log/cron


can anybody help me?

Offline
*
Re: Crontab only works manually by clicking on the 'Run'
« Reply #1 on: January 30, 2019, 04:11:26 PM »
You do realize that your cron job must point to the physical address of your php cli in whatever version of php you are using for the site.

Something like this one for automated Akeeba Backups for Wordpress:

Code: [Select]
/opt/alt/php71/usr/bin/php /home/USERNAME/public_html/wp-content/plugins/akeebabackupwp/app/cli/backup.php

Offline
*
Re: Crontab only works manually by clicking on the 'Run'
« Reply #2 on: April 07, 2021, 09:30:32 PM »
Hi, have exactly same problem with my cron job. If I click on run so cron working perfectly, but not automatically every 12 hours as planned:


Code: [Select]
0 0,12 * * * sudo tar -cvpzf /home/backups/myhomepage_$( date +"%Y_%m_%d_%H-%M-%S" ).tar.gz -C /home/myhomepage/ public_html
Code: [Select]
0 0,12 * * * /usr/bin/mysqldump --routines -u mydatabase -p'mypassword' mydatabase |  gzip >  /home/backups/mydatabase_$( date +"%Y_%m_%d_%H-%M-%S" ).sql.gz
need some help, please

Regards guys

Offline
*
Re: Crontab only works manually by clicking on the 'Run'
« Reply #3 on: April 09, 2021, 11:18:12 AM »
No answer yet although I have the PRO version, very strange

Offline
*
Re: Crontab only works manually by clicking on the 'Run'
« Reply #4 on: April 13, 2021, 02:26:05 PM »
Hello... same here... manually work perfectly but not automatic!

Offline
*
Re: Crontab only works manually by clicking on the 'Run'
« Reply #5 on: April 14, 2021, 02:43:16 AM »
i happened to me, so i found out that package that the user belonged, has no enough inodes to support the cronjob

Offline
*
Re: Crontab only works manually by clicking on the 'Run'
« Reply #6 on: April 14, 2021, 01:45:48 PM »
i happened to me, so i found out that package that the user belonged, has no enough inodes to support the cronjob

hello! i have inodes in 0

Offline
*
Re: Crontab only works manually by clicking on the 'Run'
« Reply #7 on: April 15, 2021, 12:22:28 AM »
Did you check out your logs ?

Offline
*
Re: Crontab only works manually by clicking on the 'Run'
« Reply #8 on: April 20, 2021, 04:05:23 PM »
any have a solution?

Offline
*****
Re: Crontab only works manually by clicking on the 'Run'
« Reply #9 on: April 21, 2021, 06:17:08 AM »
Hi everyone.
If you have a problem with a cron job you must login to SSH as the user and try run the job manually. 99% you will have errors.
sudo command must not be used in Crontab since it will never works if the password requires.
You can ask me to solve any problem with your server for some money in pm  ;)
Services Monitoring & RBL Monitoring
http://centos-webpanel.com/services-monitor
Join our Development Team and get paid !
http://centos-webpanel.com/develope-modules-for-cwp

Installation Instructions
http://centos-webpanel.com/installation-instructions
Get Fast Support Here
http://centos-webpanel.com/support-services

Offline
*
Re: Crontab only works manually by clicking on the 'Run'
« Reply #10 on: April 21, 2021, 12:53:34 PM »
Hi everyone.
If you have a problem with a cron job you must login to SSH as the user and try run the job manually. 99% you will have errors.
sudo command must not be used in Crontab since it will never works if the password requires.

Hi... if u press the button to run the task it work... only isn't automatic...

if i run the command it work again... and isn't automatic  ::)

Offline
*
Re: Crontab only works manually by clicking on the 'Run'
« Reply #11 on: April 22, 2021, 01:52:03 PM »
error:

● crond.service - Command Scheduler
   Loaded: loaded (/usr/lib/systemd/system/crond.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2021-04-22 10:51:34 -03; 2s ago
 Main PID: 9601 (crond)
   CGroup: /system.slice/crond.service
           └─9601 /usr/sbin/crond -n

Apr 22 10:51:34 srv1.akthos.cf systemd[1]: Started Command Scheduler.
Apr 22 10:51:34 srv1.akthos.cf crond[9601]: (CRON) INFO (RANDOM_DELAY will be scaled with factor 54% if used.)
Apr 22 10:51:34 srv1.akthos.cf crond[9601]: (CRON) INFO (running with inotify support)
Apr 22 10:51:34 srv1.akthos.cf crond[9601]: (CRON) INFO (@reboot jobs will be run at computer's startup.)

Offline
*
Re: Crontab only works manually by clicking on the 'Run'
« Reply #12 on: February 27, 2022, 08:44:28 AM »
any one of you got the answer? it happened on me also

Offline
*
Re: Crontab only works manually by clicking on the 'Run'
« Reply #13 on: April 11, 2022, 07:36:36 PM »
Hi all.
Faced with the same problem. If it helps anyone, changing the "Process limit" and "Open files" settings helped me. They were originally set to "-1". Setting it to 500 and 1000, helped to run cron for users.
Also the inode was set to 0.

Also check the cron files in /var/spool/cron/
Maybe they have errors or extra spaces in them, like mine.
« Last Edit: April 11, 2022, 07:50:58 PM by LexBart »