Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

setting up crontab

i have a plesk server with debian linux installed on it.
i also have root access.
i need to install a crontab to fetch my pop mail. how exatly do i do it?

crontab */2 * * * * /var/www/vhosts/domain.com/httpdocs/support/api/cron.php

Comments

  • [LIST=1]
    [*]login as "root" using SSH (probably putty)
    [*]type in the command "crontab -e"
    [*]an editor opens
    [*]add the line "*/2 * * * * /path/to/php/executeable /path/to/api/cron.php" at the bottom
    (on my server it's "*/2 * * * * php5-cgi /home/www/web1/html/ticketsupport/api/cron.php")
    [*]end editor (the way how to close depends on your server and installed editor)
    [*]server prints out sth. like "installing new cronjob"
    [*]DONE
    [/LIST]
  • when i wrote "which php"
    i answered me: "/usr/bin/php"

    so i wrote my crontab like this:

    */2 * * * * /usr/bin/php /var/www/vhosts/domain.com/httpdocs/support/api/cron.php

    Enable Auto Cron: ON

    Mail Methods:
    Enable POP3 email fetch: ON
    Enable email piping: OFF (should this be on?)

    On the edit email:
    POP3 Status: Enable
  • if "/usr/bin/php" is the executeable itself fine.
    but maybe it's just the dir of PHP ?

    anyway : did it work or not ?
    if not : run "/usr/bin/php /var/www/vhosts/dittnett.com/httpdocs/support/api/cron.php"
    from commandline and post what it says
  • when i run it nothing happens...
    just another line...
    so i can write a new command

    i have these php folders:
    php
    php-cgi
    php-config5
    php5
    phpextdist
    phpize5
    phpunit
  • i got it to work i just tried all! :)

    but i get this report in the SSH:

    server:/usr/bin# /usr/bin/php-cgi /var/www/vhosts/domain.com/httpdocs/support/api/cron.php
    PHP Notice: Undefined index: SCRIPT_NAME in /var/www/vhosts/domain.com/httpdocs/support/main.inc.php on line 19
    PHP Notice: Undefined index: SCRIPT_NAME in /var/www/vhosts/domain.com/httpdocs/support/config.php on line 20
    PHP Notice: Undefined index: SCRIPT_NAME in /var/www/vhosts/domain.com/httpdocs/support/main.inc.php on line 79
    PHP Notice: Undefined index: REMOTE_ADDR in /var/www/vhosts/domain.com/httpdocs/support/main.inc.php on line 97
    PHP Notice: Undefined variable: dblink in /var/www/vhosts/domain.com/httpdocs/support/include/mysql.php on line 28
    PHP Notice: Undefined variable: prefix in /var/www/vhosts/domain.com/httpdocs/support/include/class.pop3.php on line 147
    PHP Notice: Undefined index: phone in /var/www/vhosts/domain.com/httpdocs/support/include/class.validator.php on line 54
    PHP Notice: Undefined index: attachment in /var/www/vhosts/domain.com/httpdocs/support/include/class.ticket.php on line 842
    PHP Notice: Undefined index: deptId in /var/www/vhosts/domain.com/httpdocs/support/include/class.ticket.php on line 880
    PHP Notice: Undefined index: source in /var/www/vhosts/domain.com/httpdocs/support/include/class.ticket.php on line 882
    PHP Notice: Undefined index: deptId in /var/www/vhosts/domain.com/httpdocs/support/include/class.ticket.php on line 892
    PHP Notice: Undefined index: ip in /var/www/vhosts/domain.com/httpdocs/support/include/class.ticket.php on line 908
    PHP Notice: Undefined index: REMOTE_ADDR in /var/www/vhosts/domain.com/httpdocs/support/include/class.ticket.php on line 908
    PHP Notice: Undefined index: phone in /var/www/vhosts/domain.com/httpdocs/support/include/class.ticket.php on line 919
    PHP Notice: Undefined index: REMOTE_ADDR in /var/www/vhosts/domain.com/httpdocs/support/include/class.ticket.php on line 461
    PHP Notice: Undefined index: attachment in /var/www/vhosts/domain.com/httpdocs/support/include/class.ticket.php on line 940
    PHP Notice: Undefined variable: prefix in /var/www/vhosts/domain.com/httpdocs/support/include/class.pop3.php on line 147
    PHP Notice: Undefined index: phone in /var/www/vhosts/domain.com/httpdocs/support/include/class.validator.php on line 54
    PHP Notice: Undefined index: attachment in /var/www/vhosts/domain.com/httpdocs/support/include/class.ticket.php on line 842
    PHP Notice: Undefined index: deptId in /var/www/vhosts/domain.com/httpdocs/support/include/class.ticket.php on line 880
    PHP Notice: Undefined index: source in /var/www/vhosts/domain.com/httpdocs/support/include/class.ticket.php on line 882
    PHP Notice: Undefined index: deptId in /var/www/vhosts/domain.com/httpdocs/support/include/class.ticket.php on line 892
    PHP Notice: Undefined index: ip in /var/www/vhosts/domain.com/httpdocs/support/include/class.ticket.php on line 908
    PHP Notice: Undefined index: REMOTE_ADDR in /var/www/vhosts/domain.com/httpdocs/support/include/class.ticket.php on line 908
    PHP Notice: Undefined index: phone in /var/www/vhosts/domain.com/httpdocs/support/include/class.ticket.php on line 919
    PHP Notice: Undefined index: REMOTE_ADDR in /var/www/vhosts/domain.com/httpdocs/support/include/class.ticket.php on line 461
    PHP Notice: Undefined index: attachment in /var/www/vhosts/domain.com/httpdocs/support/include/class.ticket.php on line 940
    PHP Notice: Undefined variable: prefix in /var/www/vhosts/domain.com/httpdocs/support/include/class.pop3.php on line 147
    PHP Notice: Undefined index: phone in /var/www/vhosts/domain.com/httpdocs/support/include/class.validator.php on line 54
    PHP Notice: Undefined index: attachment in /var/www/vhosts/domain.com/httpdocs/support/include/class.ticket.php on line 842
    PHP Notice: Undefined index: deptId in /var/www/vhosts/domain.com/httpdocs/support/include/class.ticket.php on line 880
    PHP Notice: Undefined index: source in /var/www/vhosts/domain.com/httpdocs/support/include/class.ticket.php on line 882
    PHP Notice: Undefined index: deptId in /var/www/vhosts/domain.com/httpdocs/support/include/class.ticket.php on line 892
    PHP Notice: Undefined index: ip in /var/www/vhosts/domain.com/httpdocs/support/include/class.ticket.php on line 908
    PHP Notice: Undefined index: REMOTE_ADDR in /var/www/vhosts/domain.com/httpdocs/support/include/class.ticket.php on line 908
    PHP Notice: Undefined index: phone in /var/www/vhosts/domain.com/httpdocs/support/include/class.ticket.php on line 919
    PHP Notice: Undefined index: REMOTE_ADDR in /var/www/vhosts/domain.com/httpdocs/support/include/class.ticket.php on line 461
    PHP Notice: Undefined index: attachment in /var/www/vhosts/domain.com/httpdocs/support/include/class.ticket.php on line 940
    X-Powered-By: PHP/5.2.0-8+etch7
    Set-Cookie: PHPSESSID=0u27atda5j49bclq0cfhk9c9d3; path=/
    Expires: Thu, 19 Nov 1981 08:52:00 GMT
    Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
    Pragma: no-cache
    Content-type: text/html


    changed my domain with domain.com
  • OK, I had this same problem, and fixed it earlier, but forgot what I had done to fix it. Had so go back to the original and compare.

    Here is the corrected 'api/cron.php':
    <?php
    /*********************************************************************
    cron.php

    File to handle cron job calls (local and remote).

    Peter Rotich <peter@osticket.com>
    Copyright (c) 2006,2007,2008 osTicket
    http://www.osticket.com

    Released under the GNU General Public License WITHOUT ANY WARRANTY.
    See LICENSE.TXT for details.

    vim: expandtab sw=4 ts=4 sts=4:
    $Id: $
    **********************************************************************/
    require_once('../main.inc.php');
    require_once(INCLUDE_DIR.'class.dept.php');
    require('api.inc.php');
    require_once(INCLUDE_DIR.'class.cron.php');
    Cron::POP3(); //pop3 mail fetch
    Cron::Tickets(); //Tickets related crons.
    ?>


    Vs

    Original:
    <?php
    /*********************************************************************
    cron.php

    File to handle cron job calls (local and remote).

    Peter Rotich <peter@osticket.com>
    Copyright (c) 2006,2007,2008 osTicket
    http://www.osticket.com

    Released under the GNU General Public License WITHOUT ANY WARRANTY.
    See LICENSE.TXT for details.

    vim: expandtab sw=4 ts=4 sts=4:
    $Id: $
    **********************************************************************/
    require('api.inc.php');
    require_once(INCLUDE_DIR.'class.cron.php');
    Cron::POP3(); //pop3 mail fetch
    Cron::Tickets(); //Tickets related crons.
    ?>
Sign In or Register to comment.