Regarding Shell scripting

Shyamala
Tera Contributor

How to backup files using shell scripting for every 5 minutes on ubuntu

2 REPLIES 2

Vishal Birajdar
Giga Sage

Hi @Shyamala  

 

1.Create one file and add below line of code in that file

 

sourceFile="give/here/sourceFile path"
targetFolder="give/here/targetFolder pathe"

cp -r $sourceFile/* $targetFolder/

 

 

2.Make that file executable

chmod +x fileName.sh

 

3.Use crontab to schedule the job

crontab -e

 

Write the below line in cron job

 

*/5 * * * * /Path/of/fileName.sh

 

 

 

 

Vishal Birajdar
ServiceNow Developer

I know one thing, and that is that I know nothing.
- Socrates

Thanks for your reply!!..

 

It is not working for me.