ISPConfig Cron Jobs - where are the logs

Discussion in 'General' started by kyferez, Jun 27, 2018.

  1. kyferez

    kyferez Member

    So I know that the /var/log/cron isn't the logs for the cron jobs setup in ISPConfig. And I found a thread that said the logs would be in /var/log/syslog, however I do not have that file in CentOS7... So where would I find the logs?

    Viewing the output of the /etc/cron.d/ispc_chrooted_web1 I see my cron job. It's path keeps coming up wrong.
    I Enter as the command in the gui */5 minutes, * for all others, and Check Log. The command I enter as:
    /var/www/clients/client1/web1/web/otrs/bin/otrs.Daemon.pl start
    But it comes out as this, note the wrong path:
    */5 * * * * web1 /web/web/otrs/bin/otrs.Daemon.pl start >>/private/cron.log 2>>/private/cron_error.log #mysite.com

    So I changed what I entered in the command to this:
    cd /var/www/clients/client1/web1/web/otrs/bin/ && ./otrs.Daemon.pl start
    And it came out as this, finally having the correct path!:
    */5 * * * * web1 cd /var/www/clients/client1/web1/web/otrs/bin/ && ./otrs.Daemon.pl start >>/private/cron.log 2>>/private/cron_error.log #mysite.com

    So that looks correct, but still I cannot find ANY logs for the cron job nor any files named cron.log (except /var/log/ispconfig/cron.log which seems Not to be the correct one) or cron_error.log anywhere on the system...

    So my questions are:
    Why is the path wrong when I enter it correctly?
    Where is /private/cron.log?
    Where is /private/cron_error.log?

    Thanks!
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    The path /web/otrs/bin/otrs.Daemon.pl is correct for a jailed cronjob while the path /var/www/clients/client1/web1/web/otrs/bin/ is wrong, so your manually edited cronjob contains the wrong path here, there is no such path /var/www/clients/client1/web1/web/otrs/bin/ inside the jail because /var/www/clients/client1/web1/ is / in the jail. I don't think that you can run this as jailed cronjob and that's probably the reason for the error, try to create it as unjailed cronjob. And the private folder is the private folder of your website.
     
    kyferez likes this.
  3. kyferez

    kyferez Member

    Till,

    Thank you. This daemon must run under the same user as the website. Not sure about the jailed aspect and how that changes things other than the path, but if I do this as root it will run:
    cd /var/www/clients/client1/web1/web/otrs/bin && su -c "./otrs.Daemon.pl start" -s /bin/bash web1

    So here's the only log I can find about the ISPConfig created cron job, which isn't very helpful. This is from after I fixed the path to how you said it should be since it's jailed:
    ./cron:12069:Jun 27 09:00:01 s02 CROND[21632]: (web1) CMD (cd /web/otrs/bin/ && ./otrs.Daemon.pl start >>/private/cron.log 2>>/private/cron_error.log #mysite.com)

    Few additional questions.
    1) By make an unjailed cronjob, do you mean a regurlar cron entry?
    2) Is there a reason why the cron logs were put in /private/ instead of /log/ for the site? Is it due to the permissions of /log being owned by root?
    3) No files exist in /private/. Does that mean the cron job isn't even attempting to run? Shouldn't there at least be an error from the command failing? Is there some other way I can tell what's going on?
    4) Is there a way I can try to execute the daemon from CLI using the jail the same as the cron job attempts to run it so I can see the error?

    Thanks!
     
    Last edited: Jun 27, 2018
  4. kyferez

    kyferez Member

    So I noticed that in the main crontab file, there was no blank line after the crontab jobs, which were all created by ISPConfig. This may related to the issue as cron jobs tend to not run properly (at least in CentOS) without a blank line at then end. I got tired of futzing with it so I just added my necessary job into the crontab using the below and adding a blank line after. It works. But I'd really like to understand why the cron job configured in ISPConfig for the site doesn't work...

    */5 * * * * cd /var/www/clients/client1/web1/web/otrs/bin && su -c "./otrs.Daemon.pl start" -s /bin/bash web1 | while read line; do echo `/bin/date` "$line" >> /var/log/ispconfig/cron.log; done
     
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    post the full cron.d file of the cronjob.
     
  6. kyferez

    kyferez Member

    Here is the ispc_chrooted_web1 file in the cron.d folder.

    Code:
    [root@s02 cron.d]# cat ispc_chrooted_web1
    MAILTO=''
    SHELL='/usr/sbin/jk_chrootsh'
    
    */5     *       *       *       *       web1    cd /web/otrs/bin/ && ./otrs.Daemon.pl start >>/private/cron.log 2>>/private/cron_error.log #mysite.com
    [root@s02 cron.d]#
    
     
  7. till

    till Super Moderator Staff Member ISPConfig Developer

    Ok, that's a chrooted cronjob that you have setup there and the prograns that your perl program uses are probably not installed in the jail and that's why I suggested to use a unjailed cronjob instead of a jailed one in post #2
     
  8. kyferez

    kyferez Member

    Till,
    Thank you, that makes sense. The question then is: Why no logs? There should be some error from attempting to run the perl script when it can't access the programs, right? That there are no logs is what's driving me nuts.
     

Share This Page