?
Solved

setup cron job to copy files

Posted on 2008-11-10
7
Medium Priority
?
1,802 Views
Last Modified: 2013-12-16
sorry i am very new to linux but need to copy files from one directory to another  every other day @ 1830

the cp command i have work out is

cp -f /var/www/html/admin/modules/core/etc/* /home/support

how do i create a cron to do this
0
Comment
Question by:James Murrell
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 29

Expert Comment

by:fosiul01
ID: 22921567
to create a cron job you need to type

contab -e

then

have to give time when you want to copy .

0 22 * * 0 cp -f /var/www/html/admin/modules/core/etc/* /home/support

it wil copy your files at 10  pm every day

just chagne the type to test as your need


0
 
LVL 40

Accepted Solution

by:
omarfarid earned 2000 total points
ID: 22921582
to add a crontab job, run

EDITOR=vi
export EDITOR
crontab -e

the above will give you temp file to edit using vi editor (with your current crontab jobs, if any)

add line similar to

30 18 */2 * * /usr/bin/cp -f /var/www/html/admin/modules/core/etc/* /home/support

save and quit
add the line t
0
 
LVL 31

Author Comment

by:James Murrell
ID: 22921626
add the line t ???
0
Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

 
LVL 40

Expert Comment

by:omarfarid
ID: 22921654
sorry, it is typo (cut and paste problem)
0
 
LVL 29

Expert Comment

by:fosiul01
ID: 22921812
HI
sorry

i just realized my answer was not fully correct because i didnot add /usr/bin before cp

anyway, just a quick add: if you use /usr/bin cp -f  : it might not work because some time cp command is attached with only /bin directory.

to find out where is cp : whereis cp  

thanks
0
 
LVL 31

Author Closing Comment

by:James Murrell
ID: 31515022
cheers that was a life saver
0
 
LVL 14

Expert Comment

by:Deepak Kosaraju
ID: 22924658
set the cron job under /etc/crontab as
30 18 */2 * *  /bin/cp -f /var/www/html/admin/modules/core/etc/* /home/support
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to demonstrate how we can use conditional statements using Python.
This article will show you step-by-step instructions to build your own NTP CentOS server.  The network diagram shows the best practice to setup the NTP server farm for redundancy.  This article also serves as your NTP server documentation.
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses
Course of the Month13 days, 18 hours left to enroll

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question