Você está na página 1de 3

Scheduled Backup on Linux

The Objective:
We use lots of crond tasks for making timely back up of our
various windows and Linux servers. Some of the windows servers
(Runs IIS on windows XP) are switched off at the end of the day
(after 17:30 hours as the office closes and the power supply is
switched off.)

All the senior executives update these small servers (running


from their desktop PCs) during the day. During the daily meeting
at 4 pm ,the webpages from these servers are opened and the
discussions are held.
(These serves are located at http://192.168.75.15 and at
http://192.168.175.64 ).
(Two of them are shown...)

Immediately after discussion the webpages are updated by the


same senior executives again.

We have regional control centers all around the country (Mumbai,


Delhi, Patna, Hyderabad and Lucknow) which are run round the
clock. Now during the night and odd hours (like holidays and
weekends) when these small servers are out of service the
control room engineers go to the alternate server page and get
the daily dose of the meeting.

How we achieve it:


The alternate site is located on an Open Suse 10.2 server. (P4 ,
2GB RAM and SCSI HDD).The IP address is 192.168.175.253. The
following scripts are dumped in an executable shell file say
myscript.sh

now in a su create the following directories first


> su
# cd /mnt
# mkdir amita wrcc abtwr

content of myscript.sh is here


#----------------------------------------------------------------------------------------------------------------
--
mount //192.168.175.15/os /mnt/amita -o username=everyone,password=''
cp -rfu /mnt/amita/2006-07/ /srv/www/htdocs/my_suse_server_page/2006-07/
umount /mnt/amita

mount //192.168.175.64/os /mnt/wrcc -o


username=myusername2,password='mypassword2'
cp -rfu /mnt/wrcc/2007-08/project*/ /srv/www/htdocs/my_suse_server_page/2007-
08/
umount /mnt/wrcc
mount //192.168.175.133/os /mnt/abtwr -o
username=myusername3,password='mypassword3'
cp -rfu /mnt/abtwr/2007-08/exbus/Apr*/
/srv/www/htdocs/my_suse_server_page/abtwr/Apr*/
umount /mnt/abtwr
#--------------------------------------------------------------------------------------------------------
save the myscript.sh file and then
chmod +x myscript.sh

The above file is simply going to the various windows servers and then copy
(force, overwrite without asking) the various files in the
/srv/www/htdocs/my_suse_server_page/ (This is the document root page of the
alternate server,which runs round the clock..) and then un mount those drives.

At the odd hours these pages will be available at


http://192.168.175.253/ my_suse_server_page/

The timely backup:


now we have a crond scheduler like this
The file name is say mycrond
The content of this file is like this.
#--------------------------------------------------------------------------------------------
# file name is mycrond
# Every day at 10:45 , 15:45 and 17:45 the back up taken.After that the office is
closed.
# minute hour day week month owner filename
# save the file and then chmod +x mycrond
# put this file in /etc/cron.d
45 10,15,17 * * * root /home/bera/myscript.sh
#----------------------------------------------------------------------------------------------------

Now everyday at 10:45 , 13:45 and 17:45 the back up is taken. And after 18:00
hours when the executives are gone the alternate page will be working for the
regional control centers all across the country. For tape backup or CD backup ,you
can do that from this PC now.

Bye,
S. Bera

Você também pode gostar