Schedule a Control Application using Cron or similar

I would like to Cron job a Control Application… but I can’t seem to get it to work from cron running it with PHP directly from the command line. If I use the index.php file in the folder of my application, or if I use the application name + .php (Example Myapp.php) I get the same output with error:

  PHP Fatal error:  Using $this when not in object context in /var/www/Myapp/index.php on line 1636 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"             "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">          <HTML>          <HEAD>           <TITLE></TITLE>           <META http-equiv="Content-Type" content="text/html; charset=" />           <META http-equiv="Expires" content="Fri, Jan 01 1900 00:00:00 GMT"/>          <META http-equiv="Pragma" content="no-cache"/>           <link rel="stylesheet" type="text/css" href="../_lib/css/Sc6_Silver/Sc6_Silver_form.css" />           <link rel="stylesheet" type="text/css" href="../_lib/css/Sc6_Silver/Sc6_Silver_form.css" />           <link rel="stylesheet" type="text/css" href="../_lib/buttons//.css" />          </HEAD>          <body class="scFormPage">           <div class="scFormBorder">           <table align="center" style="width: 100%" class="scFormTable"><tr><td class="scFormDataOdd" style="padding: 15px 30px; text-align: center">            Unauthorized user          <br />           <form name="Fseg" method="post"                                action="Myapp_fim.php"                                target="_self">             <input type="hidden" name="script_case_init" value=" 

From commandline
wget --quiet -O /var/log/logfile.txt http://localhost/application/index.p...r=valparameter

From commandline

wget --quiet -O /var/log/logfile.txt http://localhost/application/index.php?parameter=valparameter

A control is a form application and require interactive control. That’s why it won’t work in a cron. You can - however - create applications in sc for cron. But then you need to use blank applications. Advantage is that you can use the connection and db macro’s.

Thank you both for your help.

@cerelli Its working perfectly now!

@aducom I wondered if “Control” was the correct kind of application to use when I started creating this… I see now where “Blank” would have been a better way to go, since Im just using a text box to display the output from my own PHP code thats in an onload event.

Well apearantly the form does work in a cron. But I wonder where the output is going to…

I think its dropping the output into that log file thats specified… but it just overwrites it each time (I hope) or It will just keep getting bigger. :slight_smile: