Hi, I'm currently having some issues setting up new cronjobs on my server. Old cronjobs seem to work fine, new ones do not. I have no idea when this problem first started. The first website I created some months ago also has a couple of cronjobs assigned to it, which are working perfectly fine. However, any newly created cronjobs (for any website) refuse to execute (well, at least it appears like they don't execute - I created a task which should execute a test script which writes the results to a file in order to confirm whether it's working or not, unfortunately nothing is being written to the file (manually running the script works fine, so no problems there either)). The ISPConfig Cronjob log remains completely empty as well. The test cronjob looks like this: Code: * * * * * /usr/bin/php /var/www/clients/client4/web21/web/test.php What could be the cause of this issue?
ispc_web21: Code: MAILTO='' SHELL='/bin/sh' */5 * * * * web21 /usr/bin/php /var/www/clients/client4/web21/web/support/api/cron.php #***.org * * * * * web21 /usr/bin/php /var/www/clients/client4/web21/web/test.php #***.org
Sorry, somehow missed your post. The cronjobs are looking fine, the cronjob is not jailed so php is available there. can you run the scripts manually as user web21 with: su web21 /usr/bin/php /var/www/clients/client4/web21/web/support/api/cron.php
'su web21' doesn't really seem to do anything (it won't change the current user). I also tried 'su - web21' instead, no luck there either.
Hmm, works here. But this might be the case at my server because I have a shell user added in ispconfig for that website.
Ok. Does the cronjob work when you run: /usr/bin/php /var/www/clients/client4/web21/web/support/api/cron.php as root user? And did you try to restart the cron daemon? Thats ok, this log is not used by website cronjobs, the log is only for errors that occur in ispconfig. So a empty log means that there are no errors in ispconfig.
It seems to work fine when executed as the root user, yes. The server has been rebooted not long ago (while this problem was already present).
try to add a ssh user to that website in ispconfig ( a ssh user without chroot) and then login to the server with this ssh user and try to run the command from your crontab.
This is pretty old, but unfortunately I stumbled upon this issue again today (it was never fixed, I simply forgot about this as it has always been working just fine for my main website and I wasn't really in need of cronjobs for other websites (and now I am) - I only discovered the issue at that time due to some testing of scripts). I've been digging around looking for the cause, and found this in the cron log files: Code: Jan 15 00:07:01 server2 CROND[14327]: (CRON) ERROR chdir failed (/var/www/clients/client4/web21/./home/web21): No such file or directory Which sheds some light on what's going on... I proceeded by looking up the home directory of the user 'web21': Code: /var/www/clients/client4/web21/./home/web21 Which matches the path cron is trying to read from... but I still don't really understand why it's trying to read from the user's home directory instead of the path supplied in the actual cronjob... my initial thought was that this is due to Chrooted Crons, but I have cronjobs set to Full Cron (just for testing) for this particular user, so I guess that can't really be it? I feel like I am overlooking something, but I'm not sure what that is...
ispc_web21: Code: MAILTO='' SHELL='/bin/sh' * * * * * web21 /usr/bin/php /var/www/clients/client4/web21/web/cron_test.php #*
Thats a non jailed job indeed, I dont see a reason why it fails here. Did you try to run the job as user web21 on the shell? e.g.: sudo -u web21 /usr/bin/php /var/www/clients/client4/web21/web/cron_test.php
Maybe you can try this, add a small shell script, e.g. /var/www/clients/client4/web21/private/cron.sh in the private folder of this website. in the script you add: Code: #!/bin/bash PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin . /etc/profile umask 022 web21 /usr/bin/php /var/www/clients/client4/web21/web/cron_test.php make the script executable and chown it to the right user: chown web21:client4 cron.sh chmod +x cron.sh then change the cronjob to: /var/www/clients/client4/web21/private/cron.sh
Code: Jan 15 14:47:01 server2 CROND[1819]: (CRON) ERROR chdir failed (/var/www/clients/client4/web21/./home/web21): No such file or directory