Control Web Panel

WebPanel => CentOS 7 Problems => Topic started by: ThiagoHG on January 29, 2019, 03:57:10 PM

Title: Crontab only works manually by clicking on the 'Run'
Post by: ThiagoHG 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?
Title: Re: Crontab only works manually by clicking on the 'Run'
Post by: DA_MAN 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
Title: Re: Crontab only works manually by clicking on the 'Run'
Post by: Jack_C 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
Title: Re: Crontab only works manually by clicking on the 'Run'
Post by: Jack_C on April 09, 2021, 11:18:12 AM
No answer yet although I have the PRO version, very strange
Title: Re: Crontab only works manually by clicking on the 'Run'
Post by: KatiaSisHost on April 13, 2021, 02:26:05 PM
Hello... same here... manually work perfectly but not automatic!
Title: Re: Crontab only works manually by clicking on the 'Run'
Post by: 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
Title: Re: Crontab only works manually by clicking on the 'Run'
Post by: KatiaSisHost 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
Title: Re: Crontab only works manually by clicking on the 'Run'
Post by: altomarketing on April 15, 2021, 12:22:28 AM
Did you check out your logs ?
Title: Re: Crontab only works manually by clicking on the 'Run'
Post by: KatiaSisHost on April 20, 2021, 04:05:23 PM
any have a solution?
Title: Re: Crontab only works manually by clicking on the 'Run'
Post by: 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.
Title: Re: Crontab only works manually by clicking on the 'Run'
Post by: KatiaSisHost 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  ::)
Title: Re: Crontab only works manually by clicking on the 'Run'
Post by: KatiaSisHost 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.)
Title: Re: Crontab only works manually by clicking on the 'Run'
Post by: CWP Lovers on February 27, 2022, 08:44:28 AM
any one of you got the answer? it happened on me also
Title: Re: Crontab only works manually by clicking on the 'Run'
Post by: LexBart 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.