TIME NOW
World current time now,
CALENDAR
Calendar monthly, yearly
login CONVERT LENGTH
login CONVERT TEMPERATURE
login DICTIONARIES, LISTS
login SCIENCE EDUCATION RELIGION
login WORK CALCULATOR
login CALCULATE LIFE

Linux commands, scripts, examples, tutorial

Previous articlePage bottomNext article  ALL TOPICS

Linux. Simple backup example: cp, mkdir commands

 Simple backup for linux OS config files, used with cron:

#!/bin/sh

d=`date +'%m-%d'`

folder='/_some'
usr='/usr/local'

folder='/some_config_backup'

mkdir -p $folder/$d
mkdir -p $folder/$d/etc
mkdir -p $folder/$d/etc/mail
mkdir -p $folder/$d/etc/proftpd
mkdir -p $folder/$d/etc/init.d
mkdir -p $folder/$d/usr
mkdir -p $folder/$d$usr
mkdir -p $folder/$d$usr/apache2
mkdir -p $folder/$d$usr/apache2proxy
mkdir -p $folder/$d/root
mkdir -p $folder/$d/$usr/lib

for file in crontab hosts.allow hosts.deny passwd shadow group hosts my-medium.cnf my-small.cnf resolv.conf my.cnf
do

   cp -p /etc/$file $folder/$d/etc/$file

done

cp -p /root/.* $folder/$d/root 2>/dev/null
cp -pr $usr/apache2/conf $folder/$d$usr/apache2 2>/dev/null
cp -pr $usr/apache2proxy/conf $folder/$d$usr/apache2proxy 2>/dev/null
cp -p $usr/lib/php.ini $folder/$d$usr/lib/php.ini 2>/dev/null
cp -p /etc/init.d/rc.local $folder/$d/etc/init.d/ 2>/dev/null
cp -p /etc/mail/sendmail.cf $folder/$d/etc/mail 2>/dev/null
cp -p /etc/proftpd/proftpd.conf $folder/$d/etc/proftpd/proftpd.conf 2>/dev/null

exit 0
 
Previous articlePage topNext article  ALL TOPICS


Guest:
Hi

This example is not based on hard links
may better to use pdumpfs


2013-06-13 10:50:10

 Use username: Guest, Anonymous, Programmer






QUOTES:
The fate of love is that it always seems too little or too much.
Anonymous
It is in learning music that many youthful hearts learn to love.
Ricard
It is as hard to take success as it is failure.
Louise Nevelson