Page 1 of 3 123 LastLast
Results 1 to 10 of 25

Thread: crontab

  1. #1
    Join Date
    May 2008
    Beans
    17

    crontab

    I have Ubuntu Server 8.04LTS (Hardy Heron). I have several perl scripts that I need to automatically run daily, each script needs to run a on different hour and their are a total of 24 scripts. THey are all located in /var/www/cgi-bin/ All of the scripts work print to a .txt if i manually run them. I created a crontab called auto which is in the same directory as all the other files. when I type crontab -l this is what is shows me

    0 0 * * * 0.pl
    0 1 * * * 1.pl
    0 2 * * * 2.pl
    0 3 * * * 3.pl
    0 4 * * * 4.pl
    0 5 * * * 5.pl
    0 6 * * * 6.pl
    0 7 * * * 7.pl
    0 8 * * * 8.pl
    0 9 * * * 9.pl
    0 10 * * * 10.pl
    0 11 * * * 11.pl
    0 12 * * * 12.pl
    0 13 * * * 13.pl
    0 14 * * * 14.pl
    0 15 * * * 15.pl
    0 16 * * * 16.pl
    0 17 * * * 17.pl
    0 18 * * * 18.pl
    0 19 * * * 19.pl
    0 20 * * * 20.pl
    0 21 * * * 21.pl
    0 22 * * * 22.pl
    0 23 * * * 23.pl

    so i believe that means that they are registered with the cron stuff.
    anyone have any ideas on what the problem might be?

    thanks

  2. #2
    Join Date
    Jan 2007
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: crontab

    Is /var/www/cgi-bin/ in your path? If not, add a path statment at the top of the crontab file (PATH= add this to the end of your path :/var/www/cgi-bin/ ).

    If that doesn't work you might want to post one of the pl files.
    Last edited by drs305; May 24th, 2008 at 10:52 PM.

  3. #3
    Join Date
    May 2008
    Beans
    17

    Re: crontab

    ok i changed all of the paths and now they all look like this

    0 0 * * * /var/www/cgi-bin/0.pl


    also here is the perl script that it needs to run, i do knwo for sure that teh script works


    my $url = 'http://en19.tribalwars.net/map/tribe.txt';
    use LWP::Simple;
    my $content = get $url;
    open W,">0.txt";
    @array=split(/,/, $content);
    $n=1;
    $j=4;
    do
    {
    print W "@array[$n] @array[$j]\n";
    $n=$n+5;
    $j=$j+5;
    }
    while ($n<=$#array);
    close W;

  4. #4
    Join Date
    Jan 2007
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: crontab

    I don't use perl but I am pretty sure you need to designate the path to perl at the beginning of the file. If you do a search for crontab and perl you can probably find an answer if no one comes to your assistance here.

  5. #5
    Join Date
    May 2008
    Beans
    17

    Re: crontab

    do you mean like #!/usr/bin/perl ??

  6. #6
    Join Date
    May 2008
    Beans
    17

    Re: crontab

    do you mean #!usr/lib/perl?

  7. #7
    Bruce M. is offline Chocolate Ubuntu Mocha Blend
    Join Date
    Sep 2007
    Beans
    Hidden!

    Re: crontab

    Quote Originally Posted by frenchface View Post
    do you mean #!usr/lib/perl?
    That's right. - without the ? though

  8. #8
    Join Date
    May 2008
    Beans
    17

    Re: crontab

    i added that to all the scripts i'll see if it stars to work

  9. #9
    Join Date
    Jan 2008
    Beans
    4,757

    Re: crontab

    First line should look like this:
    Code:
    #!/usr/bin/perl
    And also. Sorry if this sounds odd...

    But are all the scripts identical?
    If so, why not just have one script put inside the "/etc/cron.hourly" folder? (Or at the very least have one script that is ran hourly).

    Regards
    Iain
    Last edited by ibuclaw; May 24th, 2008 at 11:44 PM.

  10. #10
    Join Date
    May 2008
    Beans
    17

    Re: crontab

    no they are not identically. otherwise that would have made it alot easier

Page 1 of 3 123 LastLast

Tags for this Thread

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
  •