From: "osmcruzl on
I’m running Suse 10.3 Server and looking for a script like this that will
backup all the system config files and any others that I would want, this is
a db and mailbox users backup for my mail server ….. But I plan migrating
to a new server, using the same distro that’s why I’m preparing it for
restore again in case of emergency



Any comments are welcome



Bye



……



echo ""

echo " BACKUP file Systems"

echo ""

echo ""

echo " Security copy"

echo "----------------------------------------------"

echo ""

DIR_BACKUP="/media/backups"

DATE=`date +%Y-%m-%d-%H.00`

DATE_OUT=`(date -r $(( $(date +script-security-backup) - (3 * 86400)))
+%Y-%m-%d-%H.00)`

# ---------- DB -------------

#Security copy

echo " -= Data Base =-"

if [ -d "/media/backups/db/db_$DATE" ]; then

echo "Already exist /media/backups/db/db_$DATE"

else

##Backup mysql

echo "Security backup /media/backups/db/db_$DATE"

mkdir /media/backups/db/db_$DATE

chmod 700 /media/backups/db/db_$DATE

cp -Rp /var/lib/mysql/* /media/backups/db/db_$DATE

chmod 700 /media/backups/db/db_$DATE/*

rm /media/backups/db/db_$DATE/ib*

cd /media/backups/db

tar cvzf db_$DATE.tar.gz ./db_$DATE

rm -rf ./db_$DATE

##Backup IMAP

echo "Security backup /media/backups/db/db-imap_$DATE"

mkdir /media/backups/db/db-imap_$DATE

chmod 700 /media/backups/db/db-imap_$DATE

cp -Rp /var/lib/imap/* /media/backups/db/db-imap_$DATE

chmod 700 /media/backups/db/db-imap_$DATE/*

tar cvzf db-imap_$DATE.tar.gz ./db-imap_$DATE

rm -rf ./db-imap_$DATE

##Backup mailbox

echo "Security backup /media/backups/users/users_$DATE"

mkdir /media/backups/users/users_$DATE

chmod 700 /media/backups/users/users_$DATE

cp -Rp /var/spool/imap/user/* /media/backups/users/users_$DATE

chmod 700 /media/backups/users/users_$DATE/*

cd /media/backups/users

tar cvzf users_$DATE.tar.gz ./users_$DATE

rm -rf ./users_$DATE



fi



#Delete old copy

if [ -d "/media/backups/db/db_$DATE_OUT" ]; then

rm -rf /media/backups/db/db_$DATE_OUT

echo "old copy deleted /media/backups/db/db_$DATE_OUT"

fi

echo ""



echo ""

echo ".: Finish :."

echo ""
From: donovan jeffrey j on

On Apr 8, 2010, at 9:57 PM, osmcruzl(a)gmail.com wrote:

> I’m running Suse 10.3 Server and looking for a script like this that will backup all the system config files and any others that I would want, this is a db and mailbox users backup for my mail server ….. But I plan migrating to a new server, using the same distro that’s why I’m preparing it for restore again in case of emergency
>
> Any comments are welcome
>
> Bye
>
> ……
>
> echo "yay"

greetings

check out mailbfr for mail related configurations.

http://osx.topicdesk.com/content/view/41/57/

-j
From: Victor Duchovni on
On Thu, Apr 08, 2010 at 07:57:45PM -0600, osmcruzl(a)gmail.com wrote:

> I'm running Suse 10.3 Server and looking for a script like this that will
> backup all the system config files and any others that I would want, this is
> a db and mailbox users backup for my mail server ?.. But I plan migrating
> to a new server, using the same distro that's why I'm preparing it for
> restore again in case of emergency

If you manage your server configuration in an-hoc way, directly on the
machine, rather than via a config management system that pushes managed,
revision controlled, configurations to the server, you're solving the
wrong problem. If at all possible, change how you operate your systems
so that the master copies of configuration files are managed indirectly.

In the mean-time. Postfix configuration files are expected to be found
in /etc/postfix and any other config_directories of additional Postfix
instances. If your master.cf runs some services in a chroot jail, you
need to have working tooling to re-create such a chroot jail for each
queue directory.

You may also have Postfix-related SASL configuration files, TLS
certificates and keys, aliases(5) tables, content-filter configuration
files, start scripts and executables. External delivery agent scripts
and configuration files, related user accounts, mailstore-related
cron jobs, cron jobs to update A/V signatures and RBL feeds, ...

The list goes on and on. No generic script can figure out how to migrate
your mail system from one system to another. If you are lucky and you
test carefully, you'll find all the pieces by hand.

A better solution is a configuration management system that builds working
systems by pushing all the required components to a freshly-minted generic
Unix server with a reasonably compatible base O/S.

--
Viktor.

P.S. Morgan Stanley is looking for a New York City based, Senior Unix
system/email administrator to architect and sustain our perimeter email
environment. If you are interested, please drop me a note.

From: Ansgar Wiechers on
On 2010-04-08 osmcruzl(a)gmail.com wrote:
> I'm running Suse 10.3 Server and looking for a script like this that
> will backup all the system config files and any others that I would
> want, this is a db and mailbox users backup for my mail server ?..
> But I plan migrating to a new server, using the same distro that's why
> I'm preparing it for restore again in case of emergency
>
> Any comments are welcome
[...]
> cp -Rp /var/lib/mysql/* /media/backups/db/db_$DATE
> cp -Rp /var/lib/imap/* /media/backups/db/db-imap_$DATE
> cp -Rp /var/spool/imap/user/* /media/backups/users/users_$DATE

Unless you stopped the respective daemons beforehand, these are likely
to leave you with inconsistent databases after a restore. Either stop
the respective services for the time of the backup, or use the
appropriate export tools (e.g. mysqldump for MySQL). You can't simply
copy the files of a running database.

Also I'd suggest to use "rsync -a" instead of "cp -Rp" for performing
file backups.

Regards
Ansgar Wiechers
--
"Abstractions save us time working, but they don't save us time learning."
--Joel Spolsky

From: Ansgar Wiechers on
On 2010-04-08 donovan jeffrey j wrote:
> On Apr 8, 2010, at 9:57 PM, osmcruzl(a)gmail.com wrote:
>> I'm running Suse 10.3 Server and looking for a script like this that
>> will backup all the system config files and any others that I would
>> want, this is a db and mailbox users backup for my mail server ?..
>> But I plan migrating to a new server, using the same distro that's
>> why I'm preparing it for restore again in case of emergency
>>
>> Any comments are welcome
>
> check out mailbfr for mail related configurations.
>
> http://osx.topicdesk.com/content/view/41/57/

mailbfr was developed for Mac OS X, not for SuSE Linux. IIRC it's a
Python script, so it should be possible to modify it to be usable on
Linux as well. However, right now mailbfr is distributed as a .pkg, so
one would have to go to some lengths to even extract the actual script
from the package.

Regards
Ansgar Wiechers
--
"Abstractions save us time working, but they don't save us time learning."
--Joel Spolsky