The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Perl Flunkie

Discussion in 'General Discussion' started by Express, May 2, 2003.

  1. Express

    Express Active Member

    Joined:
    Apr 20, 2003
    Messages:
    43
    Likes Received:
    0
    Trophy Points:
    6
    How would a perl script be written that would copy one file to another file?

    I would use this perl script 3 times just inside of each perl script I would want the output when ran copying a file to another file. Then I would run each cron file via cron.


    So would have
    perl1 copy test1.php to go.php
    perl2 copy test2.php to go.php
    perl2 copy test3.php to go.php

    then I run all three perl scripts via cron at different times. Each time it would run it would show the new go.php file until the next perl file was run via the next cron tab.

    Hope this explains it good enough.

    Any help would be appreciated
     
  2. PWSowner

    PWSowner Well-Known Member

    Joined:
    Nov 10, 2001
    Messages:
    2,948
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    ON, Canada
    This would be your first perl script:

    #!/usr/bin/perl

    system ("cp -f /path/to/test1.php /path/to/go.php");
    exit;


    Call it perl1.pl or whatever you prefer.

    Make 2 more scripts for test2 and test3, and set the cron job.

    You need the full path to the files, and make sure the perl script permissions are 755 or 700.
     
  3. Express

    Express Active Member

    Joined:
    Apr 20, 2003
    Messages:
    43
    Likes Received:
    0
    Trophy Points:
    6
    Thank you worked great.
     
  4. PWSowner

    PWSowner Well-Known Member

    Joined:
    Nov 10, 2001
    Messages:
    2,948
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    ON, Canada
    I remember when I was a perl newbie. :eek:
    Due to my age, it took a while to get the hang of it, :rolleyes: but it's fun now. :p
     
Loading...

Share This Page