Author Topic: Backup  (Read 667 times)

Offline goldman

  • Newbie
  • *
  • Posts: 42
  • Karma: 4
    • View Profile
Backup
« on: Février 22, 2007, 09:03:18 pm »
Bonjour

Est ce qu'un backup fait avec DirectAdmin peut être restauré avec cPanel et vis vers ça !

merci

Offline staff

  • Tech. EdelweissHosting
  • Administrator
  • Hero Member
  • *****
  • Posts: 6048
  • Karma: 50
    • View Profile
    • EdelweissHosting
Re : Backup
« Reply #1 on: Février 22, 2007, 09:21:30 pm »
Bonsoir

Il y a un outil qui permet de transformer les backups cPanel en backups Direct Admin puis de les restaurer. On a cet outil sur quelques serveurs parce qu'on a souvent des clients qui arrivent depuis des hébergeurs cPanel.

Dans le sens contraire, on ne connait pas. Mais peut être qu'une personne sur le forum saura.

Merci
Membre Staff EdelweissHosting
Site Principal: http://edelweisshosting.com
Votre IP: http://edelweisshosting.com/ip.php

Offline goldman

  • Newbie
  • *
  • Posts: 42
  • Karma: 4
    • View Profile
Re : Backup
« Reply #2 on: Février 23, 2007, 02:50:17 pm »
Bonjour

ça a l'ère compliqué ... regadrez cela http://www.webhostingtalk.com/showthread.php?t=336093

Offline staff

  • Tech. EdelweissHosting
  • Administrator
  • Hero Member
  • *****
  • Posts: 6048
  • Karma: 50
    • View Profile
    • EdelweissHosting
Re : Backup
« Reply #3 on: Février 23, 2007, 03:30:01 pm »
Il faut voir tout son temps !!! Vaut mieux prendre les fichiers par FTP et faire un backup des bases de données depuis phpmyadmin.



- copy the quota file
- copy the IMAP folders and inbox folder of the main account
- copy the squirrelmail settings
for EACH e-mail account it does this:
- generate the entry and update the shadow and passwd file with its username and password (you keep everyone's passwords!)
- copy the IMAP folders and inbox to the respective directory

to the domain files, it does this also:
- update references in every file (php, html, etc) by removing "domains/domain.net"
(ie /home/skyhorse/domains/skyhorse.org/public_html becomes /home/skyhorse/public_html)

This does not handle FTP settings, subdomain settings, dns settings, or anything else.
But hey, it saved me hundreds of hours of pain...

It is easily improved, so if you do, please send it back to me

BTW, the scripts assumes you're using the SAME username in directadmin and in cpanel for each account, and the same domains as well.
It is also

It can also take a bit of hard disk space, since it literally duplicates the accounts files. If this is an issue, script around it to use the /tmp directory or even better, do some pipelining with tar

One last thing, although you see the CHMOD command being used, when untaring all files loose the damn permissions.
you NEED to change the permissions manually (inbox NEEDS to be group writable) or find a way to resolve the issue, which I couldn't.

here it is anyway, remember to replace the variables with your own settings:

# bash
# Copyleft (C) SkyHorse 2004
# for each account:
# put passwd as passwd + shadow
# quota (if != 0)
# into ~/etc/%domain%
GENDOMAIN=domain.com
GENUSERNAME=accuser
NEWACCPASS=accpass
MYFILESPATH=/home/skyhorse/temp_sites


mkdir result
mkdir result/mail
mkdir result/mail/$GENDOMAIN
mkdir result/etc
mkdir result/etc/$GENDOMAIN

cp $MYFILESPATH/$GENUSERNAME/backup/$GENDOMAIN/email/quota result/etc/quota
chmod 644 result/etc/quota

touch result/etc/shadow
chmod 640 result/etc/shadow

touch result/etc/passwd
chmod 644 result/etc/passwd

chmod 660 $MYFILESPATH/$GENUSERNAME/backup/email_data/imap/*
cp $MYFILESPATH/$GENUSERNAME/backup/email_data/imap/* result/mail
cp $MYFILESPATH/$GENUSERNAME/backup/email_data/pop/$GENUSERNAME result/mail/inbox
chmod 660 result/mail/inbox

mkdir result/.sqmaildata
cp $MYFILESPATH/$GENUSERNAME/backup/email_data/squirrelmail/* result/.sqmaildata

ENTRY=`cat $MYFILESPATH/$GENUSERNAME/backup/$GENDOMAIN/email/passwd`
for line in $ENTRY
do
login=`echo $line | sed s/[:].*//`
pass=`echo $line | sed s/.*[:]//`
mkdir result/mail/$GENDOMAIN/$login
mkdir result/mail/$login

echo $login:x:32120:622::/home/$GENUSERNAME/mail/$GENDOMAIN/$login:/usr/local/cpanel/bin/noshell >> result/etc/passwd
echo $login:$pass::::::: >> result/etc/shadow

chmod 750 result/mail/$GENDOMAIN/$login
cp $MYFILESPATH/$GENUSERNAME/backup/$GENDOMAIN/email/data/pop/$login result/mail/$GENDOMAIN/$login/inbox
chmod 660 result/mail/$GENDOMAIN/$login/inbox

cp $MYFILESPATH/$GENUSERNAME/backup/$GENDOMAIN/email/data/imap/$login/.mailboxlist result/mail/$GENDOMAIN/$login/
cp $MYFILESPATH/$GENUSERNAME/backup/$GENDOMAIN/email/data/imap/$login/mail/* result/mail/$GENDOMAIN/$login/

touch result/mail/$login/inbox
chmod 660 result/mail/$login/inbox
done

cp result/etc/* result/etc/$GENDOMAIN/


#domain files
cd domains/$GENDOMAIN
#update file references - this one liner deletes domains/domain.net in every file of the tree.
# efectively changes:
#/home/username/domains/domain.net/public_html into
#/home/username/public_html
find ./ -type f -exec sed -i 's/domains\/$GENDOMAIN\///' {} \;

cp -R * ../../result
cd ../../result

tar --owner=$GENUSERNAME --group=$GENUSERNAME -czf ../$GENUSERNAME-$GENDOMAIN.tar.gz *
cd ..

#upload tar.gz
#I have ncftpput installed, but because most people don't, I've commented it out
#ncftpput -u $GENUSERNAME -p $NEWACCPASS localhost / $GENUSERNAME-$GENDOMAIN.tar.gz


#database:

#mysql

#subdomains

#ftp
Membre Staff EdelweissHosting
Site Principal: http://edelweisshosting.com
Votre IP: http://edelweisshosting.com/ip.php