LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Closed Thread
 
Search this Thread
Old 04-25-2005, 03:17 AM   #1
ahmed4linux
LQ Newbie
 
Registered: Aug 2004
Posts: 23

Rep: Reputation: 15
simple-backup-script


hi ,
folks i am writting this coz it may be help full to any new guy.

the purpose of this script is to tar the required files and ftp them to any remote location.

it is tested on rh9 platform, as dont have any other.

_____________________________________________________
#!/bin/sh
DATE=`date +%F` ###this will set current date to DATE value
echo " so the file is present we will tar all important files"
echo " the important files is user information and group imformation"
echo " user home directories"
echo " users mails /var/spool/directory"
############
#### now creating real back up
###########
tar -cvf "$DATE.tar" "/etc/hosts" "/var/spool/mail" "/etc/resolv.conf" ### creates DATE.tar file
tar -vrf "$DATE.tar" "/etc/passwd" "/etc/shadow" "/etc/group" "/var/www" ## append to files
tar -vrf "$DATE.tar" "/etc/httpd/conf/httpd.conf" "/var/named" "/etc/named.conf"
##### YOU can also check if the DATE.tar file was created or not ###########
### DATE.tar file will be u r current date eg:- 2005-04-25.tar ###########
##### u can also gzip it if u want to compress it ######
echo "Now we will ftp the created backup File"
ftp -n <Hostname or IP address/ of FTP server> <<abcdef
user <username> <password>
ls #### it optional i am checking and changing directory on
cd back ### ftp server
bin ### switching to binary format
hash #### enabling hash printing
put "$DATE.tar" ### uploading u r backup tar file
bye #### logging out of ftp server
abcdef
exit 0 ### end of script
_______________________________________
this was very scrapy but working script....
later it can also be added to crontab entry for automation.
set all executable permissions to script
suppose our script is backup.sh at /var/back/
chmod +x /var/back/backup.sh ##command to set executable permission on file
____________________
just type at console it will open a text editor usually i work with vi
crontab -e
_________
now in that open editor type
30 2 * * 1,3,5,7 /var/back/backup.sh ####eg :- /var/back/back.sh -> pacth to file

now save and close
___________________________
this will execute u r back up script every monday, wed,friday, sunday at night 2:30
______________________________________________

now if any one want to modify or add or beautify this u can surely do it.
thanks in advance.
 
Old 05-04-2005, 07:10 PM   #2
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 197Reputation: 197
Why did you post this again? You already posted it in this very same forum a few days back found here: http://www.linuxquestions.org/questi...hreadid=316873

Read our rules you agreed to when registering here: http://www.linuxquestions.org/rules.php

Specifically where it states to not crosspost the same discussion, threads or questions more than once in the same forum or any other forum, etc.

 
  


Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Iptables (with masq) troubleshooting, very simple script attached script and logs. xinu Linux - Networking 13 11-01-2007 04:19 AM
Simple backup system Azhrarn Linux - Software 1 09-16-2005 02:24 PM
Simple help with a backup script GraemeK Linux - Software 1 05-20-2005 11:43 PM
simple backup script needed ferret_dude Programming 4 05-24-2004 08:45 AM
Simple way to backup my laptop enine Linux - General 2 02-04-2004 01:00 PM


All times are GMT -5. The time now is 09:13 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration