#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    56
    Rep Power
    14
    I'd written a script to get stock values from some site and put them onto a mySQL Database every minute or so. the script works fine except that I have to ssh to my server at phpwebhosting.com in order to have it running. is there a way to configure it such that it runs automatically everyday or so?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Aug 2000
    Location
    Indiana
    Posts
    614
    Rep Power
    15
    Run a crontab. Make a file called crons.txt (or whatever you want it to be) and put this line in it:

    1 * * * * perl /full/path/to/script.pl

    then at the command prompt type this:

    crontab crons.txt

    This will setup your crontab for the info in crons.txt.

    Now the system will "perl /full/path/to/script.pl" every minute"
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    56
    Rep Power
    14
    Thanks so much.

    Few more questions. How do I know if my service provider is running cron the daemon? and I tried it with a simple perl script to print something out but it doesn't do anything after long wait. what should I do?

    thanks again.

    --Ben
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Aug 2000
    Location
    Indiana
    Posts
    614
    Rep Power
    15
    PHP Web Hosting allows you to run crons. (I know this from experience). The only way to check it is to have it e-mail you something, it wont print anything to the screen. Just setup a simple e-mail program and set it in the crontab.

    P.S. You can type "crontab -l" at the command prompt to see your current crons.
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    56
    Rep Power
    14
    Thanks so much. So the idea of having the program to update a mysql database should work from what I understand?

    Thanks again.

    --Ben.
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    56
    Rep Power
    14
    my script has not been working. Can you check with me if I have the crontab configuration correct?

    my user name in phpwebhosting is moliu.

    * * * * * perl /home2/moliu/cgi-bin/test.pl

    should I use quotation or something like that?
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Aug 2000
    Location
    Indiana
    Posts
    614
    Rep Power
    15
    I don't think that the server will let you put * * * * *. This would run every second.. that's not something the server wants you to do.

    No, you don't need quotes.

IMN logo majestic logo threadwatch logo seochat tools logo