Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8989343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:14:04+00:00 2026-06-15T22:14:04+00:00

This is how my controller looks like <?php defined(‘SYSPATH’) or die(‘No direct script access.’);

  • 0

This is how my controller looks like

<?php defined('SYSPATH') or die('No direct script access.');

class Controller_Cron extends Controller {

    public function before() {

        if(!Kohana::$is_cli) ;
    }

    public function action_index() {
        $myFile = "C:\cron.txt";
        $fh = fopen($myFile, 'w') or die("can't open file");
        fwrite($fh, "\n");
        $stringData = date('Y-m-d H:i:s');
        fwrite($fh, $stringData);
        fclose($fh);
    }
}

?>

I run the script through a command line using this

php "C:\Program Files (x86)\EasyPHP\www\myweb\index.php" --uri=cron/index

where cron is the controller and index is a function.

Now what I need is to run the script every x-minute

When I run the script through the browser, it is only that time that the C:\cron.txt is modified.
I heart by putting this

public function before() {

        if(!Kohana::$is_cli) ;
    }

was to avoid any access via the browser ?
So,
1. How can I deny access from the browser ?
2. How can I make the code running every x-minute ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T22:14:05+00:00Added an answer on June 15, 2026 at 10:14 pm

    Use these two links to get what you need.Cron Jobs in Kohana 3

    A module that can help kohana-cron
    Kohana Minion

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a controller that looks like this: public class PageController : Controller {
Currently I am using a basic error controller which looks like this: class ErrorController
So this is how my startup model looks like: <?php class Test extends Zend_Db_Table{
My setup currently looks like this application/controllers/register.php class register_Controller extends Base_Controller { public $restful
I have a simple Controller that looks like this:- @Controller @RequestMapping(value = /groups) public
We are having this problem with a controller right now; the controller looks like
I'm using Spring MVC and jquery autocomplete, my spring controller looks like this @RequestMapping(value
This is what my controller action looks like [HttpPost] [OutputCache(Location = OutputCacheLocation.None)] public ActionResult
If your controller action looks like this: respond_to do |format| format.html { raise 'Unsupported'
Not sure what's going on here... My controller methods looks like this: [HttpGet] public

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.