Thread: Cron Job

Page 2 of 2 FirstFirst 12
Results 11 to 20 of 20
  1. #11
    Join Date
    Nov 2007
    Location
    Sunny Coast, Australia
    Posts
    3,379
    Plugin Contributions
    9

    Default Re: Cron Job

    Quote Originally Posted by Cenkki View Post
    It doesn't change store status open (0), with all combination.
    Played with this on a local install. I changed

    PHP Code:
    if ((date(H) >= $store_open) && (date(H) <= $store_close)) { 
    to

    PHP Code:
    if ((date('H:i:s') >= $store_open) && (date('H:i:s') <= $store_close)) { 
    and it appears to work

  2. #12
    Join Date
    Sep 2010
    Location
    Finland
    Posts
    59
    Plugin Contributions
    0

    Default Re: Cron Job

    You know this work.
    Thanks

  3. #13
    Join Date
    Nov 2007
    Location
    Sunny Coast, Australia
    Posts
    3,379
    Plugin Contributions
    9

    Default Re: Cron Job

    Quote Originally Posted by Cenkki View Post
    You know this work.
    Thanks
    Good to see that you got this working for you now.

    Cheers / Frank

  4. #14
    Join Date
    Apr 2011
    Location
    Espoo, Finland
    Posts
    46
    Plugin Contributions
    0

    Default Re: Cron Job

    Hello,

    The described solution works, but I found out, it causes the following PHP Warning (in case the sctipt is being executed by cron, not from Admin):

    PHP Warning: include() [<a href='function.include'>function.include</a>]: Failed opening 'includes/languages/english/' for inclusion (include_path='.:/usr/lib64/php:/usr/share/pear') in /.../admin/includes/init_includes/init_languages.php on line 38
    Here is the appropriate part of init_languages.php (strings 34...39):

    Code:
    // include the language translations
      require(DIR_WS_LANGUAGES . $_SESSION['language'] . '.php');
      $current_page = basename($PHP_SELF);
      if (file_exists(DIR_WS_LANGUAGES . $_SESSION['language'] . '/' . $current_page)) {
        include(DIR_WS_LANGUAGES . $_SESSION['language'] . '/' . $current_page);
      }
    I have found out, the $SERVER['PHP_SELF'] is an empty string (in case the script is being executed by cron!), thus $current_page is also empty.

    How such issue can be fixed?

    Thank you in advance and best regards,

    AR

  5. #15
    Join Date
    Nov 2007
    Location
    Sunny Coast, Australia
    Posts
    3,379
    Plugin Contributions
    9

    Default Re: Cron Job

    Quote Originally Posted by yesaul View Post
    Hello,

    The described solution works, but I found out, it causes the following PHP Warning (in case the sctipt is being executed by cron, not from Admin):



    Here is the appropriate part of init_languages.php (strings 34...39):

    Code:
    // include the language translations
      require(DIR_WS_LANGUAGES . $_SESSION['language'] . '.php');
      $current_page = basename($PHP_SELF);
      if (file_exists(DIR_WS_LANGUAGES . $_SESSION['language'] . '/' . $current_page)) {
        include(DIR_WS_LANGUAGES . $_SESSION['language'] . '/' . $current_page);
      }
    I have found out, the $SERVER['PHP_SELF'] is an empty string (in case the script is being executed by cron!), thus $current_page is also empty.

    How such issue can be fixed?

    Thank you in advance and best regards,

    AR
    Take a look at this plugin - created after reading through this thread.

    Cheers / Frank

  6. #16
    Join Date
    Apr 2011
    Location
    Espoo, Finland
    Posts
    46
    Plugin Contributions
    0

    Default Re: Cron Job

    Quote Originally Posted by frank18 View Post
    Take a look at this plugin - created after reading through this thread.
    Hello,

    Thank you for your reply, but could you please explain, now your plugin can help to find an answer to my question?

    Your plugin uses application_top.php in standard way and will generate the similar warnings as I described.

    In fact, my question is: how to force PHP-server to put correct information in the appropriate entries ('PHP_SELF' and 'SCRIPT_NAME') of $_SERVER array, in case the script is running as cron job (not from Admin).

    According to PHP Manual: "The entries in this array are created by the web server. There is no guarantee that every web server will provide any of these; servers may omit some, or provide others not listed here".

    I sent also an support request to my hosting provider, but I have still no reply.


    BR, AR

  7. #17
    Join Date
    Nov 2007
    Location
    Sunny Coast, Australia
    Posts
    3,379
    Plugin Contributions
    9

    Default Re: Cron Job

    Quote Originally Posted by yesaul View Post
    ......
    The described solution works, but I found out, it causes the following PHP Warning (in case the sctipt is being executed by cron, not from Admin):...
    Considering your installation works when the script is executed from admin, take a look at the readme.html file contained in the ASOC plugin. The 'Configuration' tab in that file says:

    Configuration


    1. Login to your cPanel (or similar installation)
    2. Go to Cron TabsCreate 2 new cron jobs and enter these configurations (or equivalent)

      These times need to be adjusted to reflect your actual opening closing times.
    Do you still get the error when you use the suggested lines in the cron tab?
    Last edited by frank18; 7 Sep 2014 at 12:29 AM.

  8. #18
    Join Date
    Apr 2011
    Location
    Espoo, Finland
    Posts
    46
    Plugin Contributions
    0

    Default Re: Cron Job

    Hello,

    Thank you for your reply.

    Quote Originally Posted by frank18 View Post
    Do you still get the error when you use the suggested lines in the cron tab?
    Yes, I do.

    PHP Code:
    00 9 * * * wget http://yourdomain.com/YOUR_ADMIN/aut...open_close.php >/dev/null 2>&1 
    You offer a way, how to suppress any warnings (Here is a good article about meaning of /dev/null 2>&1)

    But $S_SERVER['PHP_SELF'] is still empty (in case the script is running from cron), and this means the language file will not be loaded in init_languages.php !

    In another words, you offer a way to hide problem, but not solve it.


    Once again, the question is: how to force PHP-server to put correct information in the appropriate entries ('PHP_SELF' and 'SCRIPT_NAME') of $_SERVER array, in case the script is running as cron job (not from Admin).


    Anyway, thank you again for you reply,

    AR

    PS And by the way, your hint is not universal, for example, /dev/null 2>&1 has no effect on my hosting provider (wget is not used for cron jobs there)
    Last edited by yesaul; 7 Sep 2014 at 09:01 AM.

  9. #19
    Join Date
    Nov 2007
    Location
    Sunny Coast, Australia
    Posts
    3,379
    Plugin Contributions
    9

    Default Re: Cron Job

    Quote Originally Posted by yesaul View Post
    Hello,

    Thank you for your reply.



    Yes, I do.

    PHP Code:
    00 9 * * * wget http://yourdomain.com/YOUR_ADMIN/aut...open_close.php >/dev/null 2>&1 
    You offer a way, how to suppress any warnings (Here is a good article about meaning of /dev/null 2>&1)

    But $S_SERVER['PHP_SELF'] is still empty (in case the script is running from cron), and this means the language file will not be loaded in init_languages.php !

    In another words, you offer a way to hide problem, but not solve it.


    Once again, the question is: how to force PHP-server to put correct information in the appropriate entries ('PHP_SELF' and 'SCRIPT_NAME') of $_SERVER array, in case the script is running as cron job (not from Admin).


    Anyway, thank you again for you reply,

    AR

    PS And by the way, your hint is not universal, for example, /dev/null 2>&1 has no effect on my hosting provider (wget is not used for cron jobs there)
    No need to get uptight - only trying to help.

    And putting phrases into bold is considered shouting on this forum, it does not earn you any brownie points, it can get you put on ignore lists.

    BTW: being a Linux person, I am fully aware about the meaning of /dev/null 2>&1 , in hindsight I should have left it out from my post, just copied from my own setup for convenience.

    Are you saying that wget can not be used on on your hosting account? If it is a true Linux server and properly configured then wget should work a breeze (and leave out the /dev/null 2>&1 ... )

    My setup uses the exact scripting as provided in my mod on a professional CentOS server and it works a treat - time to talk to your host or even change host.

  10. #20
    Join Date
    Apr 2011
    Location
    Espoo, Finland
    Posts
    46
    Plugin Contributions
    0

    Default Re: Cron Job

    Hello, Please excuse me - I have been definitely not going to be impolite!

    I'm very thankful for your replies, but you try to explain me (again and again), how to hide the problem, but not solve it...

    Do you have any ideas, why PHP_SELF and SCRIPT_NAME entries of $_SERVER array are defined, but empty (in case the script is running from cron) ?


    Awfully sorry again and best reagards,

    AR

 

 
Page 2 of 2 FirstFirst 12

Similar Threads

  1. v154 Cron job coding
    By droidmcse in forum All Other Contributions/Addons
    Replies: 1
    Last Post: 24 Apr 2015, 11:29 PM
  2. Cron Job to enable a EZ Page?
    By cs_jono in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 4 Jun 2010, 08:20 PM
  3. CRON job help
    By Jeff G in forum General Questions
    Replies: 10
    Last Post: 9 Oct 2008, 12:20 AM
  4. zen_mail as part of a cron job...
    By savage in forum General Questions
    Replies: 0
    Last Post: 30 Nov 2007, 06:25 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR