Cron Job Setup?

Discussion in 'Installation/Configuration' started by D-Spayre, Mar 28, 2012.

  1. D-Spayre

    D-Spayre New Member

    Hi,

    I'm trying to setup a Cron Job to run at 12am everyday, could someone expain what the settings would be? :confused:

    This is what I have for the command to run:
    /usr/bin/wget -q /var/www/domain/web/cron/index.php

    Thanks very much
     
  2. till

    till Super Moderator

    Minute: 0
    Hour: 12
    All other fields except of the commain field: *

    The command would be:

    http://yourdomain.com/cron/index.php

    The wget command is wrong as you cant exec php files with wget by specifying a file path, wget requires a url and beside that, ispconfig has a builtin url cron function, so you dont need wget at all and just enter the url starting with http into the command field.
     
  3. D-Spayre

    D-Spayre New Member

    Perfect thanks,

    What's the best way to test the Cron, without waiting until 12am?

    Thanks
     
  4. till

    till Super Moderator

    There are severaloptions:

    a) If you just want to test the cron script, then enter:

    http://yourdomain.com/cron/index.php

    in your broser, it will execute the script like cron will do it.

    b) Change the time of the cronjob so that it executes earlier.
     
  5. D-Spayre

    D-Spayre New Member

    Hi,

    If I type the address into the address bar my Cron job runs, but doesn't run within the ISPconfig panel.

    Minutes e.g. *, */3, 10-20 = 0
    .Hours e.g. *, */2, 0, 10-12 = 12
    .Days of month e.g. *, */4, 1-5 = *
    .Months e.g. *, 1-6 = *
    .Days of week e.g. *, 0, 1-5 = *
    Command to run (commands are executed via sh, urls via wget = http://www.mydomain.com/cron/index.php
    .Active

    Am I missing something?

    Thanks
     
  6. falko

    falko Super Moderator

    Please check your syslog for cron errors.
     
  7. D-Spayre

    D-Spayre New Member

    Where would it be located? I can't seem to find it.

    Thanks
     
  8. till

    till Super Moderator

    It is in /var/log/
     
  9. D-Spayre

    D-Spayre New Member

    HTML:
    Apr  6 00:00:01 server1 CROND[22363]: (root) CMD (/usr/lib64/sa/sa1 -S DISK 1 1)
    Apr  6 00:00:01 server1 CROND[22364]: (root) CMD (/usr/local/ispconfig/server/server.sh &> /dev/null)
    Apr  6 00:00:01 server1 CROND[22362]: (getmail) CMD (/usr/local/bin/run-getmail.sh > /dev/null 2>> /var/log/ispconfig/cron.log)
    Apr  6 00:01:01 server1 CROND[22429]: (root) CMD (/usr/local/ispconfig/server/server.sh &> /dev/null)
    Apr  6 00:01:01 server1 CROND[22430]: (root) CMD (run-parts /etc/cron.hourly)
    Apr  6 00:01:01 server1 run-parts(/etc/cron.hourly)[22430]: starting 0anacron
    Apr  6 00:01:01 server1 anacron[22458]: Anacron started on 2012-04-06
    Apr  6 00:01:01 server1 anacron[22458]: Jobs will be executed sequentially
    Apr  6 00:01:01 server1 anacron[22458]: Normal exit (0 jobs run)
    Apr  6 00:01:01 server1 run-parts(/etc/cron.hourly)[22461]: finished 0anacron
    Apr  6 00:01:01 server1 run-parts(/etc/cron.hourly)[22430]: starting awstats
    Apr  6 00:01:01 server1 run-parts(/etc/cron.hourly)[22472]: finished awstats
    Apr  6 00:01:01 server1 run-parts(/etc/cron.hourly)[22430]: starting mcelog.cron
    Apr  6 00:01:01 server1 run-parts(/etc/cron.hourly)[22479]: finished mcelog.cron
    Apr  6 00:02:01 server1 CROND[22483]: (root) CMD (/usr/local/ispconfig/server/server.sh &> /dev/null)
    Apr  6 00:03:01 server1 CROND[22506]: (root) CMD (/usr/local/ispconfig/server/server.sh &> /dev/null)
    Apr  6 00:04:01 server1 CROND[22526]: (root) CMD (/usr/local/ispconfig/server/server.sh &> /dev/null)
    Apr  6 00:05:01 server1 CROND[22560]: (getmail) CMD (/usr/local/bin/run-getmail.sh > /dev/null 2>> /var/log/ispconfig/cron.log)
    Apr  6 00:05:01 server1 CROND[22561]: (root) CMD (/usr/local/ispconfig/server/server.sh &> /dev/null)
    Apr  6 00:06:01 server1 CROND[22652]: (root) CMD (/usr/local/ispconfig/server/server.sh &> /dev/null)
    Apr  6 00:07:01 server1 CROND[22676]: (root) CMD (/usr/local/ispconfig/server/server.sh &> /dev/null)
    Apr  6 00:08:01 server1 CROND[22701]: (root) CMD (/usr/local/ispconfig/server/server.sh &> /dev/null)
    Apr  6 00:09:01 server1 CROND[22724]: (root) CMD (/usr/local/ispconfig/server/server.sh &> /dev/null)
    Not sure but is this what your looking for? This is the "Cron" file.
    I just posted the Mid Night section. There is a ton of lines in here but a lot are just repeats.

    Thanks
     
  10. falko

    falko Super Moderator

    Is your cron job listed in that log file?
     
  11. D-Spayre

    D-Spayre New Member

    Yep, here is what's in /var/log/

    Code:
    anaconda.log          dmesg.old              pureftpd.log-20120325
    anaconda.program.log  dracut.log             pureftpd.log-20120401
    anaconda.storage.log  httpd                  rkhunter
    anaconda.syslog       ispconfig              sa
    anaconda.xlog         ispconfig_install.log  samba
    anaconda.yum.log      lastlog                sa-update.log
    audit                 maillog                secure
    boot.log              maillog-20120325       secure-20120325
    btmp                  maillog-20120401       secure-20120401
    btmp-20120401         mcelog                 spooler
    clamav                messages               spooler-20120325
    ConsoleKit            messages-20120325      spooler-20120401
    cron                  messages-20120401      sssd
    cron-20120325         mysqld.log             tallylog
    cron-20120401         ntpstats               wtmp
    cups                  prelink                yum.log
    dmesg                 pureftpd.log
    Thanks
     
  12. falko

    falko Super Moderator

    No, I mean, is your cron job logged somewhere in that log file?
     

Share This Page