jeffschips

Well-Known Member
Jun 5, 2016
196
20
68
new york
cPanel Access Level
Root Administrator
Hello. I'm having issues with cron jobs running as non-root users (identified as xxxxx, below) on my cpanel/WHM. For example, one particular cron command as such:

* * * * * /usr/bin/ea-php72 /home/xxxx/public_html/xxxx/app/console mautic:emails:send >/dev/null 2>&1

will only run if I put that command in root's cron job. I've tried to troubleshoot to no avail and here are some of my findings:

ls -lha $(which crontab)

lrwxrwxrwx. 1 root root 39 May 24 2018 /usr/local/bin/crontab -> /usr/local/cpanel/bin/jail_safe_crontab

cat cron.deny
nobody

cat cron.allow
cat: cron.allow: No such file or directory

cd /var/spool

[[email protected] spool]# ls
anacron at cron exim logrotate lpd mail plymouth

[[email protected] spool]# ls -la
total 40
drwxr-xr-x. 10 root root 4096 May 24 2018 .
drwxr-xr-x. 22 root root 4096 May 27 22:30 ..
drwxr-xr-x. 2 root root 4096 Aug 8 2019 anacron
drwx------. 3 root root 4096 May 27 23:14 at
drwx------. 2 root root 4096 May 28 15:06 cron
drwxr-xr-x. 6 mailnull mail 4096 May 28 09:06 exim
drwxr-xr-x. 3 root root 4096 May 24 2018 logrotate
drwxr-xr-x. 2 root root 4096 Apr 11 2018 lpd
drwxr-xr-x. 2 root mail 4096 May 17 04:10 mail
drwxr-xr-x. 2 root root 4096 Apr 2 11:57 plymouth

[[email protected] spool]# cd cron

[[email protected] cron]# ls -la
total 20
drwx------. 2 root root 4096 May 28 15:06 .
drwxr-xr-x. 10 root root 4096 May 24 2018 ..
-rw-------. 1 root root 124 May 28 14:42 crontab
-rw-------. 1 root root 1487 May 28 15:06 xxxxx
-rw-------. 1 root root 1445 May 28 13:31 root

it's the xxxxx user that needs to run under an xxxxx cron job, but the command line does not run as user xxxxx and neither does the command run in the cron job.

Works perfectly in root's cron job so I'm guessing some file/directory permissions must be mixed up.

Any help much appreciated.
 

jeffschips

Well-Known Member
Jun 5, 2016
196
20
68
new york
cPanel Access Level
Root Administrator
Update: sending errors to a log file shows that whenever the commands run, this is happening:

Failed to lock /home/xxxxx/public_html/xxxxx/app/cache/prod/../run/sf.mautic-emails-send.f8887daadff97876adfa61884260c394951b7a5692
5ffc98f03399e9f5028fa.lock.
Script in progress. Can force execution by using --force.

Using --force in the command however does not change things.