Jack_mcs Posted December 22, 2010 Share Posted December 22, 2010 (edited) This is the support thread for the Cron Simulator contribution. Cron is a program supplied by the host that allows a script to be ran at a preset time. Many osCommerce contributions make use of Cron but not all hosts offer it so those contributions can't be used to their fullest potential on such servers. The purpose of this contribution is to simulate a Cron job. Code is added to the index page of your admin and when it is loaded, the enabled jobs are checked and ran, if it is their time to be ran. This isn't as accurate as a real Cron job but it will run the script automatically, which is what is needed. This contribution is compatible with all versions of osCommerce. Edited December 22, 2010 by Jack_mcs Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
chrish123 Posted December 22, 2010 Share Posted December 22, 2010 This is the support thread for the Cron Simulator contribution. Cron is a program supplied by the host that allows a script to be ran at a preset time. Many osCommerce contributions make use of Cron but not all hosts offer it so those contributions can't be used to their fullest potential on such servers. The purpose of this contribution is to simulate a Cron job. Code is added to the index page of your admin and when it is loaded, the enabled jobs are checked and ran, if it is their time to be ran. This isn't as accurate as a real Cron job but it will run the script automatically, which is what is needed. This contribution is compatible with all versions of osCommerce. Â Â Hello, very handy but can you please provide a basic help file on how to use your modification? As after I enter a script name, script location/filename and time it is not saving. Â I just mean a basic example of what to put in each field. Â Kind regards Chris Quote Link to comment Share on other sites More sharing options...
Jack_mcs Posted December 22, 2010 Author Share Posted December 22, 2010 Hello, very handy but can you please provide a basic help file on how to use your modification? As after I enter a script name, script location/filename and time it is not saving. Â I just mean a basic example of what to put in each field. - Run - if checked, run the script - Script Name - some arbitrary name that allows you to identify the script - File Name - name of the script to be ran, like googlefeeder.php - Time To Run - the time the script should be ran (only happens if index.php is visited so may not be accurate) - Frequency - should it be ran daily, weekly or monthly? Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
chrish123 Posted December 22, 2010 Share Posted December 22, 2010 - Run - if checked, run the script - Script Name - some arbitrary name that allows you to identify the script - File Name - name of the script to be ran, like googlefeeder.php - Time To Run - the time the script should be ran (only happens if index.php is visited so may not be accurate) - Frequency - should it be ran daily, weekly or monthly? Â Ok thanks, Im thinking I might have some kind of issue then as I entered in the fields: Â google base feed | googlefeeder.php(variations of path too) | 12 | weekly | Â I click update and its not saved. Â Im thinking maybe "tims safer database input mod" might have to be removed, not sure! Quote Link to comment Share on other sites More sharing options...
Jack_mcs Posted December 22, 2010 Author Share Posted December 22, 2010 Ok thanks, Im thinking I might have some kind of issue then as I entered in the fields:  google base feed | googlefeeder.php(variations of path too) | 12 | weekly |  I click update and its not saved.  Im thinking maybe "tims safer database input mod" might have to be removed, not sure! I just tried entering  test | admin/test.php | 12 | weekly  and it saved correctly. The time (12) needs to be in military time (1200) but otherwise I don't see a problem. Are you sure the new entry isn't in the dropdown list? Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
chrish123 Posted December 22, 2010 Share Posted December 22, 2010 I did as you said and it does not work, its not in the database as I checked in phpmyadmin also. Quote Link to comment Share on other sites More sharing options...
Jack_mcs Posted December 22, 2010 Author Share Posted December 22, 2010 I did as you said and it does not work, its not in the database as I checked in phpmyadmin also. Hmm, I don't have an answer for you then. The code that adds the entries in the admin is just standard code used in many of my contributions. There must be something in your shop or on the server that is preventing it from working but I've no way to isolate that in a thread like this. If you are able to set up a clean shop, I suggest installing it into it to isolate the problem. Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
chrish123 Posted December 22, 2010 Share Posted December 22, 2010 Yeah its really weird, It just refuses to save on a rc2a shop. The update button seems to react just like a refresh browser page button. Â I removed the modifications added by tims safer database input method (installation file is wrong anyway)... same thing! Quote Link to comment Share on other sites More sharing options...
Dan Cole Posted December 23, 2010 Share Posted December 23, 2010 Yeah its really weird, It just refuses to save on a rc2a shop. The update button seems to react just like a refresh browser page button.  I removed the modifications added by tims safer database input method (installation file is wrong anyway)... same thing!  Jack I'm having the same problem with this. When I check the database I can't help but notice that there is no index for that table. I don't know if one is needed or not but I wonder if that is preventing the data from being saved?  Dan Quote Need help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix) here. Link to comment Share on other sites More sharing options...
Jack_mcs Posted December 23, 2010 Author Share Posted December 23, 2010 Jack I'm having the same problem with this. When I check the database I can't help but notice that there is no index for that table. I don't know if one is needed or not but I wonder if that is preventing the data from being saved? No, an index, or lack of one, shouldn't make it fail. It is possible that something is wrong in the code but it works fine in my test shop and on the site I created it for. What versions of php and mysql are you using? Maybe that has something to do with it. Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
Dan Cole Posted December 24, 2010 Share Posted December 24, 2010 No, an index, or lack of one, shouldn't make it fail. It is possible that something is wrong in the code but it works fine in my test shop and on the site I created it for. What versions of php and mysql are you using? Maybe that has something to do with it. Lets see...MySQL 5.0.77 and PHP 5.2.10...dan Quote Need help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix) here. Link to comment Share on other sites More sharing options...
Jack_mcs Posted December 24, 2010 Author Share Posted December 24, 2010 The versions should be OK. Please try this. In admin/cron_simulator.php, find if (tep_not_null($action)) { if (isset($_POST['update_cron_x'])) { and change it to ?> <pre> <?php print_r($_POST); ?> </pre> <?php if (tep_not_null($action)) { echo 'action found<br>'; if (isset($_POST['update_cron_x'])) { echo 'update pressed<br>'; Try updating and post the displayed results here. Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
Dan Cole Posted December 24, 2010 Share Posted December 24, 2010 The versions should be OK. Please try this. In admin/cron_simulator.php, find if (tep_not_null($action)) { if (isset($_POST['update_cron_x'])) { and change it to ?> <pre> <?php print_r($_POST); ?> </pre> <?php if (tep_not_null($action)) { echo 'action found<br>'; if (isset($_POST['update_cron_x'])) { echo 'update pressed<br>'; Try updating and post the displayed results here.  I get this following Jack...  Array ( [action] => process [enabled_in] => on [script_name_in] => AS_SiteMap [file_name_in] => /googlesitemap/index.php [time_to_run_in] => 1259 [frequency_in] => Daily [scripts] => Select a Con Job [update_cron_x] => 41 [update_cron_y] => 11 )  Dan Quote Need help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix) here. Link to comment Share on other sites More sharing options...
Jack_mcs Posted December 24, 2010 Author Share Posted December 24, 2010 OK. Remove those changes and replace this line if (tep_not_null($action)) { with if (isset($_POST['action']) && $_POST['action'] == 'process') { Â This is what happens when they let me out of the home around the holidays. :) Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
Dan Cole Posted December 24, 2010 Share Posted December 24, 2010 OK. Remove those changes and replace this line if (tep_not_null($action)) { with if (isset($_POST['action']) && $_POST['action'] == 'process') {  This is what happens when they let me out of the home around the holidays. :) That did it Jack...it is now saving the cron job...the problem I'm now having is that it's not finding the file to be executed. I'm trying to set up a cron for your Google Site Map but when I enter either googlesitemap/index.php or /googlesitemap/index.php it can't find the file....I can execute it from the url command line but the cron module says that it can't find the file....does the file name need to be specified in any special way?  Dan Quote Need help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix) here. Link to comment Share on other sites More sharing options...
Jack_mcs Posted December 25, 2010 Author Share Posted December 25, 2010 That did it Jack...it is now saving the cron job...the problem I'm now having is that it's not finding the file to be executed. I'm trying to set up a cron for your Google Site Map but when I enter either googlesitemap/index.php or /googlesitemap/index.php it can't find the file....I can execute it from the url command line but the cron module says that it can't find the file....does the file name need to be specified in any special way? Â Dan You have to enter in the full path, like /home/username/public_html/script_name.php. Also, if the path is too long, which it probably will be, you will need to alter the size of the field in the database with this command ALTER TABLE `cron_simulator` CHANGE `file_name` `file_name` VARCHAR( 256 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL ; Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
Dan Cole Posted December 25, 2010 Share Posted December 25, 2010 You have to enter in the full path, like /home/username/public_html/script_name.php. Also, if the path is too long, which it probably will be, you will need to alter the size of the field in the database with this command ALTER TABLE `cron_simulator` CHANGE `file_name` `file_name` VARCHAR( 256 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL ; That sorted that Jack but now I seem to be running into functions that have already been declared...got this message when it tried to run the googlesitemap/index.php cron job....  Fatal error: Cannot redeclare tep_not_null() (previously declared in /xxxx/xxxxxxxxx/xxxxx/xxxxx/xxxxx/domain.com/xxxxx/admin/includes/functions/general.php:284) in /xxxx/xxxxxxxxx/xxxxx/xxxxx/xxxxx/domain.com/googlesitemap/index.php on line 72  Dan Quote Need help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix) here. Link to comment Share on other sites More sharing options...
Dan Cole Posted December 31, 2010 Share Posted December 31, 2010 That sorted that Jack but now I seem to be running into functions that have already been declared...got this message when it tried to run the googlesitemap/index.php cron job....  Fatal error: Cannot redeclare tep_not_null() (previously declared in /xxxx/xxxxxxxxx/xxxxx/xxxxx/xxxxx/domain.com/xxxxx/admin/includes/functions/general.php:284) in /xxxx/xxxxxxxxx/xxxxx/xxxxx/xxxxx/domain.com/googlesitemap/index.php on line 72  Dan Jack would you happen to know if this is a problem on my end or if something isn't quite right with the cron simulator?  Dan Quote Need help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix) here. Link to comment Share on other sites More sharing options...
Jack_mcs Posted December 31, 2010 Author Share Posted December 31, 2010 Jack would you happen to know if this is a problem on my end or if something isn't quite right with the cron simulator? Â Dan I'm sorry. I somehow missed your previous post. That is happening because the function tep_not_null has already been declared in admin and it can't be declared again. I don't know if there is a simple fix for that. You could add the code that you add to the admin/index.php file to the includes/footer.php (the other changes would be needed on the shop sitde too) but that would cause a delay whenever the script was ran and it would have to be edited to hide the output so that is not a good solution. I'll have to think on this but short of editing the googlesitemap file, I can't think of a good way around it. Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
Dan Cole Posted December 31, 2010 Share Posted December 31, 2010 I'm sorry. I somehow missed your previous post. That is happening because the function tep_not_null has already been declared in admin and it can't be declared again. I don't know if there is a simple fix for that. You could add the code that you add to the admin/index.php file to the includes/footer.php (the other changes would be needed on the shop sitde too) but that would cause a delay whenever the script was ran and it would have to be edited to hide the output so that is not a good solution. I'll have to think on this but short of editing the googlesitemap file, I can't think of a good way around it. This is probably a dumb question Jack and if so, please forgive me but if it's already declared in admin/index.php does it need to be declared again in cron simulator or could we just delete the declaration of that function in the cron simulator? If not maybe we just need to rename it?  Dan Quote Need help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix) here. Link to comment Share on other sites More sharing options...
Jack_mcs Posted January 1, 2011 Author Share Posted January 1, 2011 This is probably a dumb question Jack and if so, please forgive me but if it's already declared in admin/index.php does it need to be declared again in cron simulator or could we just delete the declaration of that function in the cron simulator? If not maybe we just need to rename it? It isn't being loaded by this contribution. When Cron Simulator is ran in admin. it loads in the application_top file, as any script in admin does. But when it tries to execute a scrit on the shop side, the shops side functions get reloaded by that script, causing the duplicate problem. The parts of the code causing the problem could be re-coded so it doesn't happen but that opens up big problem since any script ran that way would need to be rewritten and that doesn't make for a very usable contribution. The only way I can see around it without disrupting everything else is to rewrite the Cron Simulator script to run as a standalone script. But that removes the automatic process of running it so you might as well just run the scripts themselves manually. So as it stands now, scripts made to run from admin should work. Those made to run on the shop side may fail, depending upon how they are coded. I'll play around with it and post if I find a sensible solution. Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
Dan Cole Posted January 2, 2011 Share Posted January 2, 2011 It isn't being loaded by this contribution. When Cron Simulator is ran in admin. it loads in the application_top file, as any script in admin does. But when it tries to execute a scrit on the shop side, the shops side functions get reloaded by that script, causing the duplicate problem. The parts of the code causing the problem could be re-coded so it doesn't happen but that opens up big problem since any script ran that way would need to be rewritten and that doesn't make for a very usable contribution. The only way I can see around it without disrupting everything else is to rewrite the Cron Simulator script to run as a standalone script. But that removes the automatic process of running it so you might as well just run the scripts themselves manually. So as it stands now, scripts made to run from admin should work. Those made to run on the shop side may fail, depending upon how they are coded. I'll play around with it and post if I find a sensible solution.  I got it...thanks for the explanation Jack.  Dan Quote Need help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix) here. Link to comment Share on other sites More sharing options...
trentano Posted August 30, 2011 Share Posted August 30, 2011 (edited) hi jack,  i need a cronjob in this format /mailhive.php?xyz=run  to run a cronjob for mailbeez ( http://www.mailbeez.com ) is there a posibility to do that with cronjob simulator? i get an error "A valid file name is required" if i try to  an where can i delete cronjob entries? in the database i know but is there a posibility to do directly from cronjob simulator?  :( :(  greets  andy Edited August 30, 2011 by trentano Quote Link to comment Share on other sites More sharing options...
Jack_mcs Posted August 30, 2011 Author Share Posted August 30, 2011 It should work if the script is placed in admin, as explained previously. Is that where it is located? Quote Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
MattFlemm Posted October 20, 2011 Share Posted October 20, 2011 was this issue ever resolved? how did you fix it dan. i am having the same problem as you were in your previous post.. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.