setup cron job to copy files

James Murrell
James Murrell used Ask the Experts™
on
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
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2009

Commented:
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


Top Expert 2007
Commented:
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
James MurrellProduct Specialist

Author

Commented:
add the line t ???
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Top Expert 2007

Commented:
sorry, it is typo (cut and paste problem)
Top Expert 2009

Commented:
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
James MurrellProduct Specialist

Author

Commented:
cheers that was a life saver
Deepak KosarajuDevOps Engineer

Commented:
set the cron job under /etc/crontab as
30 18 */2 * *  /bin/cp -f /var/www/html/admin/modules/core/etc/* /home/support

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial