can't run a cron job

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jcor
    New Member
    • Sep 2007
    • 63

    can't run a cron job

    Hi, I'm trying to run my first cron job, probably it's missing something.

    I created a perl script just to test, it's called "teste"
    [code=perl]
    !/usr/bin/perl
    open(DATA,">>/home/joao/files/output");
    @Now = localtime(time) ;
    print DATA "@Now\n";
    exit ;
    [/code]

    I created the file "teste.cron " with the cron job. it's only a line with:
    * * * * * /home/joao/files/teste

    I uploaded the cron job with "crontab teste.cron"

    Shouldn't this be writing the date and time every minute in the file "output"?

    When I run my script manually it writes correctly in the file "output";
    If I type "crontab -l" I can see my cron job loaded;

    can somebody give me an hand?

    thanks,

    João
    Last edited by numberwhun; Nov 9 '07, 06:40 PM. Reason: add code tags
  • eWish
    Recognized Expert Contributor
    • Jul 2007
    • 973

    #2
    I am not sure if you got this issue resolved. If not the there is an article that may help you.

    Comment

    • jcor
      New Member
      • Sep 2007
      • 63

      #3
      thanks for your help. I didn´t solve this problem at the time but get my goal monitoring a folder pernmanently and triggering when occured changes instead of running the code in a cron job. Anyway i'll read the article for further using.


      thanks,

      João

      Comment

      • numberwhun
        Recognized Expert Moderator Specialist
        • May 2007
        • 3467

        #4
        Originally posted by jcor
        Hi, I'm trying to run my first cron job, probably it's missing something.

        I created a perl script just to test, it's called "teste"
        [code=perl]
        !/usr/bin/perl
        open(DATA,">>/home/joao/files/output");
        @Now = localtime(time) ;
        print DATA "@Now\n";
        exit ;
        [/code]

        I created the file "teste.cron " with the cron job. it's only a line with:
        * * * * * /home/joao/files/teste

        I uploaded the cron job with "crontab teste.cron"

        Shouldn't this be writing the date and time every minute in the file "output"?

        When I run my script manually it writes correctly in the file "output";
        If I type "crontab -l" I can see my cron job loaded;

        can somebody give me an hand?

        thanks,

        João
        Personally, I would want to see what cron is saying since it runs silently. So, that said, I would change the entry to be:

        * * * * * /home/joao/files/teste > /home/joao/files/cronjob.log

        and see if the log file shows anything happening.

        The entry looks right and the code, aside from having asthetic issues (ie: no "use warnings" or "use strict") seems to look like it would work. Try that and see what is output to the log file.

        Regards,

        Jeff

        Comment

        • pankajit09
          Contributor
          • Dec 2006
          • 296

          #5
          I want a cron software for Windows.

          Comment

          • arne
            Recognized Expert Contributor
            • Oct 2006
            • 315

            #6
            Originally posted by pankajit09
            I want a cron software for Windows.
            Did you try to Google for "cron windows"? There seem to be several projects that provide cron functionality on windows.

            HTH,
            arne

            Comment

            Working...