Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Fedora 5 Backup to usb hard drive

Posted on 2006-10-30
8
Medium Priority
?
168 Views
Last Modified: 2013-12-16
Hello EE.  I have a linux box, providing file services, firewall and proxy.  setup with help from many of you (thanks)
What I want to do is backup the /data partition (samba)  to a usb drive which is permanently attached and then shut down the machine daily at 7pm.  So basically I have a folder on the driver  which is at /media/sea_disk/Backups

I would like the daily backup to only backup what has changed.  And then on saturday do a complete backup to the same location.

And then shut down the machine.  


0
Comment
Question by:aduhwale
  • 4
  • 3
7 Comments
 
LVL 14

Accepted Solution

by:
ygoutham earned 1000 total points
ID: 17840408
for the daily backup, you can try rsync

rsync -avz --delete /data/* /media/sea_disk/Backups/

please note that the --delete is only an option if you want the target files to be deleted as well. remove it if you want to retrieve any deleted files that a user might request for (which happens at all time with me :-)

for a weekly backup, just to a

cp -Rp /data/* /media/sea_disk/Backups/  

the weekly backup and daily backup can be run through the crontab.

do a

crontab -e (as root)

01 0 * * * (your rsync command here)

and for weekly backup

01 0 * * 6 (your cp command here)

the weekly would run on mondays at the change of system clock date.   the hour can be any 24 hour format to run at a specified time.

by shutdown the machine are you stating that the machine should be powered off??? or only the usb drive to unmounted???

you can also put the same in a bash script and run it as a script at an appointed hour ending with

'shutdown -h -t 5 "an optional message here"   ' (without the initial and end single quote) at the end of the script to tell the machine to shutdown after finishing the rsync/ cp command.

goutham
0
 
LVL 14

Expert Comment

by:ygoutham
ID: 17840411
sorry the weekly command is to run on saturdays (number 6 in crontab entry is right) but monday is wrong

: - (
0
 
LVL 2

Author Comment

by:aduhwale
ID: 18094972
Hi ygoutham , wasnt ignoring you.  Got side tracked with another project.   I am testing this saturday and will then confirm i am successfull.

Regards

Adewale
0
Technology Partners: 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!

 
LVL 2

Author Comment

by:aduhwale
ID: 18198503
Thanks   ygoutham.    This worked great.  I only need help figuring out where to put the shut down command.  do i put it on the same line as the cp command.
0
 
LVL 2

Author Comment

by:aduhwale
ID: 18198545
in crontab I mean - how do you I get it to point to a script?
Thanks again.
0
 
LVL 14

Expert Comment

by:ygoutham
ID: 18198587
in crontab you have five fields

01 13 * * * sh /path/to/some/script.sh

the above line means to execute a script called script.sh which is a shell script at 13:01 hours every day.  read more on

man 5 crontab
man crontab

to shutdown a machine

shutdown -h -t 5 now

this means to shutdown the machine in 5 seconds from now and halt the system.  the same command can also go into your crontab.  but shutdown is not given enough rights to be run from crontab.  just check on the first before adding the same.  just look at /etc/sudoer
0
 
LVL 2

Author Comment

by:aduhwale
ID: 18201166
Hey.  Thanks!  
I hadnt actually written a script before.  now i have - albeit a simple one.    I am tinkering with the timings but I am good to go.

Thanks again.
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

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

Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses
Course of the Month7 days, 15 hours left to enroll

824 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