Closed Thread
Results 1 to 7 of 7

Thread: cron job

  1. #1
    HussamT is offline x10Hosting Member HussamT is an unknown quantity at this point
    Join Date
    Oct 2007
    Posts
    22

    cron job

    I want to run a cron job for my drupal installation.
    so I schedule

    0 0 * * * /usr/bin/php -f /home/username/public_html/cron.php
    or
    0 0 * * * /usr/bin/php -f http://mydomain.co.cc/cron.php ?

    Thank you

  2. #2
    HussamT is offline x10Hosting Member HussamT is an unknown quantity at this point
    Join Date
    Oct 2007
    Posts
    22

    Re: cron job

    Neither will work. is cron enabled on free accounts?

  3. #3
    HussamT is offline x10Hosting Member HussamT is an unknown quantity at this point
    Join Date
    Oct 2007
    Posts
    22

    Re: cron job

    /usr/bin/php "/home/hussam/public_html/cron.php?cron_key=abcdef" >>/home/hussam/public_html/cronlog.txt 2>&1

    replace abcdef with the cron_key

    I get
    Status: 404 Not Found
    X-Powered-By: PHP/5.2.17
    Content-type: text/html

    No input file specified.

    in the log
    the cron.php permissions are 755

    Any idea please?
    this is a drupal installation
    Last edited by HussamT; 06-08-2011 at 05:13 AM.

  4. #4
    Skizzerz's Avatar
    Skizzerz is offline Contributors Skizzerz will become famous soon enough
    Join Date
    Nov 2007
    Location
    Texas
    Posts
    2,153

    Re: cron job

    you can't pass query strings in cron jobs like that (the ?cron_key=abcdef part), just hardcode it in the script.

    /usr/bin/php /home/hussam/public_html/cron.php >> /home/hussam/cron.log 2>&1
    would be an appropriate line (script errors will get sent to a cron.log file in your home directory)
    Last edited by Skizzerz; 06-09-2011 at 12:21 AM.

  5. #5
    HussamT is offline x10Hosting Member HussamT is an unknown quantity at this point
    Join Date
    Oct 2007
    Posts
    22

    Re: cron job

    /usr/bin/php /home/hussam/public_html/cron.php >> /home/hussam/cronlog.txt logs the following:

    Status: 503 Service Unavailable
    X-Powered-By: PHP/5.2.17
    Content-type: text/html

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link rel="shortcut icon" href="/misc/favicon.ico" type="image/x-icon" />
    <title>Site off-line | Drupal</title>
    <link type="text/css" rel="stylesheet" media="all" href="/modules/system/defaults.css?0" />
    <link type="text/css" rel="stylesheet" media="all" href="/modules/system/system.css?0" />
    <link type="text/css" rel="stylesheet" media="all" href="/modules/system/system-menus.css?0" />
    <link type="text/css" rel="stylesheet" media="all" href="/modules/system/maintenance.css?0" />
    <link type="text/css" rel="stylesheet" media="all" href="/themes/garland/style.css?0" />
    <link type="text/css" rel="stylesheet" media="all" href="/themes/garland/minnelli/minnelli.css?0" />
    <link type="text/css" rel="stylesheet" media="print" href="/themes/garland/print.css?0" />
    <!--[if lt IE 7]>
    <link type="text/css" rel="stylesheet" media="all" href="/themes/garland/fix-ie.css" /> <![endif]-->
    </head>
    <body>

    <!-- Layout -->
    <div id="header-region" class="clear-block"></div>

    <div id="wrapper">
    <div id="container" class="clear-block">

    <div id="header">
    <div id="logo-floater">
    <h1><a href="/" title="Drupal"><img src="/themes/garland/minnelli/logo.png" alt="Drupal" id="logo" /><span>Drupal</span></a></h1> </div>

    </div> <!-- /header -->


    <div id="center"><div id="squeeze"><div class="right-corner"><div class="left-corner">
    <h2>Site off-line</h2> <div class="clear-block">
    <p>The site is currently not available due to technical problems. Please try again later. Thank you for your understanding.</p><hr /><p><small>If you are the maintainer of this site, please check your database settings in the <code>settings.php</code> file and ensure that your hosting provider's database server is running. For more help, see the <a href="http://drupal.org/node/258">handbook</a>, or contact your hosting provider.</small></p><p><small>The <em>mysqli</em> error was: <em>Unable to use the MySQLi database because the MySQLi extension for PHP is not installed. Check your &lt;code&gt;php.ini&lt;/code&gt; to see how you can enable it.</em>.</small></p> </div>
    <div id="footer"></div>
    </div></div></div></div> <!-- /.left-corner, /.right-corner, /#squeeze, /#center -->


    </div> <!-- /container -->
    </div>
    <!-- /layout -->

    </body>
    </html>
    so drupal's cron job isn't really running.
    Last edited by HussamT; 06-09-2011 at 12:21 PM.

  6. #6
    descalzo's Avatar
    descalzo is offline Grim Squeaker descalzo has a brilliant futuredescalzo has a brilliant futuredescalzo has a brilliant future
    Join Date
    Jul 2009
    Location
    Ankh-Morpork
    Posts
    7,635

    Re: cron job

    Try using wget instead:

    Code:
    wget -O -  http://YOURSITE/cron.php?cron_key=abcd >>/home/USERNAME/public_html/cron_log.txt 2>&1
    Nothing is always absolutely so.

  7. #7
    HussamT is offline x10Hosting Member HussamT is an unknown quantity at this point
    Join Date
    Oct 2007
    Posts
    22

    Re: cron job

    That worked. Thank you so much

Closed Thread

Similar Threads

  1. cron
    By ramzov in forum Free Hosting
    Replies: 1
    Last Post: 06-29-2010, 11:27 AM
  2. Replies: 6
    Last Post: 11-14-2009, 06:38 PM
  3. Can a cron job kick off another cron job?
    By dmoneyman in forum Programming Help
    Replies: 8
    Last Post: 04-03-2009, 08:04 PM
  4. Cron Again
    By mumbhaki in forum Programming Help
    Replies: 3
    Last Post: 05-01-2008, 01:54 PM
  5. [cron problem]php-cron command not found
    By N4rk0 in forum Free Hosting
    Replies: 1
    Last Post: 01-31-2008, 11:51 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers