Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8

Thread: Cron Jobs

  1. #1
    New Coder
    Join Date
    Jun 2002
    Posts
    40
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cron Jobs

    Hi,

    I wasn't entirely sure where to post this so I posted here.
    I was wondering if it's possible to use Cron Jobs to open a specified page once a week?

    If the page resides on your own hosted server would that be a problem? (Logically thinking that would be easiest)
    The page can open and then close after a few seconds.

    I've searched around a bit and found certain texts saying how to set up a Cron Job, but nothing explaining what you can actually do with them.

    If there is no way to accomplish this via Cron Jobs, does anyone know any other way.

    Thank You

  • #2
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,280
    Thanks
    4
    Thanked 83 Times in 82 Posts
    This is the correct forum for this question.

    You might need to elaborate on what you mean by opening a page. What kind of page?
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #3
    New Coder
    Join Date
    Jun 2002
    Posts
    40
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi

    Just any page

    Say i wanted to open http://www.codingforums.com/
    or http://www.google.com/about.html

    Would that be possible and then for it to close again after a set time period.

  • #4
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,280
    Thanks
    4
    Thanked 83 Times in 82 Posts
    That doesn't make any sense. Open it and do what? If this is running on a web host server which it would be and on a Linux server since you said CRON jobs then opening a file does not mean opening it in the sense that you would open it in a web browser.

    What is it that you are trying to achieve?
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #5
    New Coder
    Join Date
    Jun 2002
    Posts
    40
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'll take that as a no then.

    What I am trying to achieve is posted above.
    (Open/execute a page or a script that opens a page and then closes itself after a set time period)

    Say you had a .php script for logging into an ftp and uploading/downloading a text file. Would you be able to automate that process?
    If so would it be much harder to open a web page from a server. I know its port 21 & port 80 with two totally different methods.

  • #6
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,280
    Thanks
    4
    Thanked 83 Times in 82 Posts
    You can run scripts using CRON jobs for running queries on databases, you can run scripts to perform various different tasks to files etc.

    But when you say opening a website for a few seconds and then closing it doesn't make any sense at all.

    Maybe the question should be why do you need to open a website for a few seconds and then close it?
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #7
    Regular Coder
    Join Date
    May 2003
    Location
    34° 54' N 82° 13' W
    Posts
    996
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Crons run scripts. For instance -

    A cron does something like this ::

    Run delete.php at 4:30 AM Everyday

    And delete.php might empty a table in the datbase or something like that
    Stevie Peele
    Neverside IRC Network - irc.veonex.net | tc.tutorialnetwork.org
    #dev - any programming,etc. question
    #design - design discussion and critque
    #central - general chat
    Come join us!

  • #8
    New Coder
    Join Date
    Jun 2002
    Posts
    40
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I managed to figure it out

    My Cron job is (runs weekly)
    lynx -dump http://www.sitename/cron/test.php

    Then the php, which i don't fully understand but it works.

    <?php
    $fp = fopen("http://www.whatever.com/", "r") or die("OPEN");
    while (! feof($fp))
    {
    fread($fp, 1024) or die("READ");
    }
    fclose($fp) or die("CLOSE");
    ?>

    It leaves the file in my web root so now i just have to set up another to delete that.
    Last edited by Charl; 09-02-2003 at 03:37 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
    •