Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 2 > Installation/Configuration

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 27th October 2008, 11:40
vaio1 vaio1 is offline
Senior Member
 
Join Date: Jul 2007
Location: Italy
Posts: 664
Thanks: 77
Thanked 12 Times in 7 Posts
Default Auto-Backup Procedure saves all the data in a external Disk

Hi guys,

I have tried to create an automatic way to backup all the ISPConfig configurations, mails, and server configurations. How to improve it? Any idea?

Code:
#!/bin/bash

DATE=`date +%F`

COPY_TO=/mnt/mydisk
USER=root
PASSWORD=***** [YOURPASSWORD]
HOST=localhost

mount /dev/sdb1 /mnt/mydisk/

echo "";
echo "************************************";
echo "       ISP CONFIG BACKUP";
echo "************************************";
echo "";

mkdir -p $COPY_TO/ispconfig/$DATE

echo "Wait a moment please...";

echo "1. Make a backup of /var/spool/mail";
/etc/init.d/postfix stop
cd /var/spool
tar -czf $COPY_TO/ispconfig/$DATE/mail.tar.gz mail

echo "2. Copy the passwd file";
cp /etc/passwd $COPY_TO/ispconfig/$DATE

echo "3. Copy the shadow file";
cp /etc/shadow $COPY_TO/ispconfig/$DATE

echo "4. Copy the group files";
cp /etc/group $COPY_TO/ispconfig/$DATE

echo "5. Copy the Vhosts_ispconfig.conf file";
cp /etc/httpd/conf/vhosts/Vhosts_ispconfig.conf $COPY_TO/ispconfig/$DATE

echo "6. Copy the local-host-names file";
cp /etc/postfix/local-host-names $COPY_TO/ispconfig/$DATE

echo "7. Copy the postfix/virtusertable file";
cp /etc/postfix/virtusertable $COPY_TO/ispconfig/$DATE

echo "8. Copy the named.conf file";
cp /var/named/chroot/etc/named.conf $COPY_TO/ispconfig/$DATE

echo "9. Copy the proftpd.conf file";
cp /etc/proftpd.conf $COPY_TO/ispconfig/$DATE

echo "10. Copy the proftpd_ispconfig.conf file";
cp /etc/proftpd_ispconfig.conf $COPY_TO/ispconfig/$DATE

echo "11. Backup of the ISPConfig Databse";
mysqldump \
        -u$USER -p$PASSWORD -h$HOST \
        -Q -c -C --add-drop-table --add-locks --quick --lock-tables \
        db_ispconfig | gzip --best -c > $COPY_TO/ispconfig/$DATE/db_ispconfig.sql.gz;


echo "Restart Postfix"
/etc/init.d/postfix start

echo "End of procedure";
Reply With Quote
Sponsored Links
  #2  
Old 27th October 2008, 16:59
sjau sjau is offline
Local Meanie
 
Join Date: Apr 2006
Location: Switzerland
Posts: 1,158
Thanks: 4
Thanked 58 Times in 54 Posts
Default

why don't you start postfix again after you have copied the spool?
__________________
"Common sense is not as common as commonly believed" by sjau

Auto-Install Script for ISPConfig and Horde on a Vanilla Debian Stable

Need more Repos for Ubuntu? Repository Generator
Need more Repos for Debian? Debian Repository Generator
Reply With Quote
  #3  
Old 27th October 2008, 18:55
vaio1 vaio1 is offline
Senior Member
 
Join Date: Jul 2007
Location: Italy
Posts: 664
Thanks: 77
Thanked 12 Times in 7 Posts
Default

Look at the bottom of the file
Reply With Quote
  #4  
Old 27th October 2008, 19:06
sjau sjau is offline
Local Meanie
 
Join Date: Apr 2006
Location: Switzerland
Posts: 1,158
Thanks: 4
Thanked 58 Times in 54 Posts
Default

yeah, but do do you start it at the end of the backup script and not when copying spool is finished? That's just what wonders me
__________________
"Common sense is not as common as commonly believed" by sjau

Auto-Install Script for ISPConfig and Horde on a Vanilla Debian Stable

Need more Repos for Ubuntu? Repository Generator
Need more Repos for Debian? Debian Repository Generator
Reply With Quote
  #5  
Old 27th October 2008, 19:10
vaio1 vaio1 is offline
Senior Member
 
Join Date: Jul 2007
Location: Italy
Posts: 664
Thanks: 77
Thanked 12 Times in 7 Posts
Default

oh I have understood!
Thanks any other suggestions?
Reply With Quote
  #6  
Old 28th October 2008, 02:34
make-fun make-fun is offline
Member
 
Join Date: Jan 2008
Posts: 92
Thanks: 8
Thanked 8 Times in 7 Posts
Default

  1. curlftpfs - to mount a ftp host as a local directory (if no external HD)
  2. DATE=$(date +%d) - so you'll get 01-31 dirs and have older ones overwritten automatically
  3. at the end
    Code:
    if [ $(date +%d) == 01 ]; then
      echo "Monthly Backup"
      mkdir -p $COPY_TO/ispconfig/$(date --date=-1day +%b) / name of previous month e.g. Oct
      cp mkdir -p $COPY_TO/ispconfig/$DATE $COPY_TO/ispconfig/$(date +%b)
    fi
    So you keep a monthly backup for up to 12 month Jan-Dez and have older ones overwritten automatically
Reply With Quote
  #7  
Old 28th October 2008, 13:19
sjau sjau is offline
Local Meanie
 
Join Date: Apr 2006
Location: Switzerland
Posts: 1,158
Thanks: 4
Thanked 58 Times in 54 Posts
 
Default

Quote:
Originally Posted by mturillo View Post
oh I have understood!
Well, I am just wondering as to why do start the server at the end again and not at the end of the actual operation You may have good reasons for that and I'm curious so to what those are
__________________
"Common sense is not as common as commonly believed" by sjau

Auto-Install Script for ISPConfig and Horde on a Vanilla Debian Stable

Need more Repos for Ubuntu? Repository Generator
Need more Repos for Debian? Debian Repository Generator
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
chgrp error new user DKA General 15 28th July 2008 18:45
Auto backup problem informator001 General 2 17th April 2008 18:13
Postfix + VDA patch (doesn't build RPM on server) VelhaChica Server Operation 5 18th October 2007 17:50
Setting up a backup mail server setup with two installations of ISPConfig zitch Tips/Tricks/Mods 7 30th December 2006 11:07
Backup complete system on local disk IKShadow Installation/Configuration 1 25th November 2006 15:41


All times are GMT +2. The time now is 19:02.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.