Results 1 to 11 of 11
  1. #1
    Join Date
    Dec 2000
    Posts
    951

    Question How to do the following cron??

    hello,
    i have to copy/past some images for one account on another account via cron. BUT as the source and destination is different every day i have no idea how to set the cron and not sure if it is possible. What i have to do is:

    copy from /home/user/public_html/photos-05-21-2005
    to /home/otheruser/public_html/photos-05-21-2005

    then next day:

    copy from /home/user/public_html/photos-05-22-2005
    to /home/otheruser/public_html/photos-05-22-2005

    and so one.

    "photos-05-21-2005" are already exist on both accounts so i simple have to copy the pic. inside.

    is there any way to do this with a cron? if yes how?


    thanks a lot for any help.

  2. #2
    Join Date
    Aug 2004
    Location
    ring0
    Posts
    110
    you can use the date command in place of the date

    `date +%m-%d-%Y`

    eg cp /home/user/public_html/`date +%m-%d-%Y`/* /home/otheruser/public_html/`date +%m-%d-%Y`
    SERVERAXIS The arms dealer for startups
    SSD VPS and HDD Storage VPS
    Bare Metal Dedicated Servers
    Chicago - Miami

  3. #3
    Join Date
    Feb 2005
    Location
    I am air u breathe
    Posts
    229
    You can also try a simple php script that does the procedure of renaming the files with date and later call the file on cron.

    Al
    It is reliability that counts...
    Few tips

  4. #4
    Join Date
    Dec 2000
    Posts
    951
    ServerDave--- can i put this int the daily con of the root corjobs?

    just curiose: what's the * in front of the home dir?

    thanks

  5. #5
    Join Date
    Jan 2004
    Location
    Texas
    Posts
    1,556
    You can create a shell script with some if statements thrown in to accomplish this and just run that script via cron to accomplish it.
    James Lumby

  6. #6
    Join Date
    May 2003
    Location
    Florida
    Posts
    877
    Originally posted by WWWhost
    ServerDave--- can i put this int the daily con of the root corjobs?

    just curiose: what's the * in front of the home dir?

    thanks
    The * is really at the end of the source - telling you to copy all the files in the folder. Notice the space after the *

  7. #7
    Join Date
    Dec 2000
    Posts
    951
    not sure i understand.. but can i add this to the "root" conjob file?

    thanks

  8. #8
    Join Date
    Dec 2000
    Posts
    951
    nothing to do with cron. I set this to the root cronjob but does not work...

  9. #9
    Join Date
    Jun 2003
    Location
    World Wide Web
    Posts
    581
    ServerDave's command line script is just about perfect. If the cron is not working, it must be a wrong setup.
    SupportExpertz.com - the name says it all!
    Managed Cloud Servers
    Server Management and Monitoring
    24x7 outsourced customer support

  10. #10
    Join Date
    Dec 2000
    Posts
    951
    sorry but i really not familliare with cronjobs. Can you please explain how to create this cron?

    Thanks a lot

  11. #11
    Join Date
    Jun 2004
    Location
    Los Angeles
    Posts
    87
    one other thing is that some systems might include the newline character that typically follow a backtick-included command.

    I tend to use date | awk (yes, it's simply ignorance over the usage of the date formatting syntax), and it seems to work pretty well...

    Anyway, consider a brief 'sed' statement within the aforementioned cron task:

    today=`date +%m-%d-%Y|sed -e's/\s//g'`;
    cp /home/user/public_html/$today/* /home/otheruser/public_html/$today/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •