Crontab only works manually by clicking on the 'Run'

Started by ThiagoHG, January 29, 2019, 03:57:10 PM

Previous topic - Next topic

ThiagoHG

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.
* * * * * 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:
* * * * * user php /home/user/public_html/mautic/app/console mautic:iplookup:download
but 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?

DA_MAN

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:

/opt/alt/php71/usr/bin/php /home/USERNAME/public_html/wp-content/plugins/akeebabackupwp/app/cli/backup.php

Jack_C

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:


0 0,12 * * * sudo tar -cvpzf /home/backups/myhomepage_$( date +"%Y_%m_%d_%H-%M-%S" ).tar.gz -C /home/myhomepage/ public_html

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

Jack_C

No answer yet although I have the PRO version, very strange

KatiaSisHost

Hello... same here... manually work perfectly but not automatic!

altomarketing

i happened to me, so i found out that package that the user belonged, has no enough inodes to support the cronjob

KatiaSisHost

Quote from: altomarketing 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

hello! i have inodes in 0



Igor S.

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

KatiaSisHost

Quote from: Igor S. 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.

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  ::)

KatiaSisHost

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.)

CWP Lovers

any one of you got the answer? it happened on me also

LexBart

#13
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.