Loading ...
Sorry, an error occurred while loading the content.

Re: [PBML] Perl & Cron Jobs

Expand Messages
  • Jenda Krynicky
    From: Gordon Stewart ... What happens if you run the script from the shell? It waits for you to enter the query doesn t it? Maybe
    Message 1 of 6 , Aug 31, 2003
    • 0 Attachment
      From: Gordon Stewart <gordon52@...>
      > Basically, If I run the script from the browser - It displays ok. If I
      > run it as a cron-job, it SHOULD record the same information, into the
      > 1st log file (if any)
      >
      > If anyone understands cron jobs, & CGI scripts, can they please
      > reply, advising that Im correct - or totally blind.

      What happens if you run the script from the shell?
      It waits for you to enter the query doesn't it? Maybe that's what
      happens when you start the script via cron, it just sits there trying
      to read from STDIN, doing nothing.

      From the docs of CGI.pm:

      If you are running the script from the command line or in the
      perl
      debugger, you can pass the script a list of keywords or
      parameter=value
      pairs on the command line or from standard input (you don't have
      to
      worry about tricking your script into reading from environment
      variables).

      Jenda
      ===== Jenda@... === http://Jenda.Krynicky.cz =====
      When it comes to wine, women and song, wizards are allowed
      to get drunk and croon as much as they like.
      -- Terry Pratchett in Sourcery
    • Gordon Stewart
      ... I guess my ISP / Host is having cron-job problems (the website says that cron-jobs are updated (to the main job list i guess) every hour..) I came online a
      Message 2 of 6 , Sep 1, 2003
      • 0 Attachment
        At 06:15 PM 8/31/03 +0200, Jenda wrote:

        >What happens if you run the script from the shell?
        >It waits for you to enter the query doesn't it? Maybe that's what
        >happens when you start the script via cron, it just sits there trying
        >to read from STDIN, doing nothing.

        I guess my ISP / Host is having cron-job problems (the website says that
        cron-jobs are updated (to the main job list i guess) every hour..)

        I came online a few days ago, & uploaded the test script etc..

        & yesterday - the cron job (test script) - sucessfully started, (& is
        still) merrily telling me the time - (in the log file) - every minute :)

        Yesterday, I logged on, & uploaded my NEW / Correct cron job list..

        & came home today & my old/test script is STILL telling me the time..

        So Ive sent a message to 'admin' (support dont seem to know..) - Advising
        how often cron jobs are updated

        I guess nothing to do - but wait..

        (anyone got a spare $2.5 million ? - ) - I'll buy my own ADSL / Cable - &
        live off the interest - & run my site from home..

        G.


        [Non-text portions of this message have been removed]
      • Damien Carbery
        ... ISP/host ... cron job ... into the ... But its ... I still ... I think Jenda s response is probably spot on. Change: use CGI param ; use CGI
        Message 3 of 6 , Sep 1, 2003
        • 0 Attachment
          --- In perl-beginner@yahoogroups.com, Gordon Stewart <gordon52@s...>
          wrote:
          >
          > My cron jobs have ceased to function, for almost a week :-(
          >
          >
          > Hi there - Its been over 24 hours since I posted this script to my
          ISP/host
          > web forum, & ive had no responses (either telling me my script /
          cron job
          > is correct, or if theyre not correct.)
          >
          > Basically, If I run the script from the browser - It displays ok.
          > If I run it as a cron-job, it SHOULD record the same information,
          into the
          > 1st log file (if any)
          >
          > If anyone understands cron jobs, & CGI scripts, can they please reply,
          > advising that Im correct - or totally blind.
          >
          > PS - the directory name /www/g/gorstew/logs/ IS correct..
          >
          > Thanks..
          >
          > G.
          >
          > =-=-=-=-=-=-=-=-=-=-=-=-
          >
          > Is this script correct ?
          > Read carefully & follow instructions.
          >
          >
          > in my
          > /www/g/gorstew/etc/crontab file I have (ive split it into 3 lines,
          But its
          > on 1 line) :-
          >
          > * * * * * /www/g/gorstew/cgi-bin/test/test1.cgi
          > >>/www/g/gorstew/logs/cron.log
          > 2>>/www/g/gorstew/logs/cron.err
          >
          >
          > ok - The following script (in between the equals line) is my FULL
          > test/test1.cgi
          >
          > the time is now :-
          > US Naval Observatory Master Clock Time
          >
          > August 29, 13:13:05 UTC
          > August 29, 09:13:05 AM E
          > August 29, 08:13:05 AM C
          > August 29, 07:13:05 AM M
          > August 29, 06:13:05 AM P
          > August 29, 05:13:05 AM Y
          > August 29, 03:13:05 AM A
          >
          >
          > Can anyone tell me if Im crazy, Or just plain blind
          >
          > I did upload this test yesterday - & found that after a few HOURS -
          I still
          > had no cron-jobs.
          >
          > Can anyone tell me what they think it will do (ESPECIALLY the log files)
          >
          > ================
          > #!/usr/bin/perl
          >
          > #use strict;
          >
          > use CGI::Carp qw(fatalsToBrowser);
          > use CGI 'param';
          > use CGI qw/:standard/;
          > use CGI::Cookie;
          > use lib './';
          > #use lib '/www/g/gorstew/cgi-bin/groupmail/';
          >
          >
          > print "Content-type: text/html\n\n";
          >
          > print "<HTML><BODY>\n";
          >
          > $t=localtime(time);
          > print "HELLO THERE MATE - $t\n";
          >
          > print "</BODY>\n</HTML>\n";
          > ================

          I think Jenda's response is probably spot on.

          Change:
          use CGI 'param';
          use CGI qw/:standard/;
          to:
          use CGI qw/ :standard param -no_debug /;

          Why was 'use CGI' on two lines? Doesn't ':standard' include 'param'?
        • Andi Permadi
          Hi All, How to create Perl database link to MS-SQL 2000 Server ? Thankyou !!!
          Message 4 of 6 , Sep 1, 2003
          • 0 Attachment
            Hi All,
            How to create Perl database link to MS-SQL 2000 Server ?
            Thankyou !!!
          • Damien Carbery
            ... I really shouldn t respond to this because if you did a bit of looking around you d find the answer. Maybe: DBIx::MSSQLReporter You can get it from:
            Message 5 of 6 , Sep 1, 2003
            • 0 Attachment
              --- In perl-beginner@yahoogroups.com, "Andi Permadi" <andi@a...> wrote:
              > Hi All,
              > How to create Perl database link to MS-SQL 2000 Server ?
              > Thankyou !!!

              I really shouldn't respond to this because if you did a bit of looking
              around you'd find the answer.

              Maybe:
              DBIx::MSSQLReporter

              You can get it from:
              http://ppm.activestate.com/PPMPackages/zips/8xx-builds-only/Windows/
            Your message has been successfully submitted and would be delivered to recipients shortly.