PDA

View Full Version : Backup remote server (ISPconfig host)


Franz
17th August 2009, 02:05
Hi,
i create litle bash script for remote backup my hosting server.

Script is executed form my home linux server and backup files and database from remote server.

here is link for script:
Remota backup linux server (http://blog.it-podrska.info/2009/08/backup-remote-linux-mysql-and-data/)

admins
19th August 2009, 19:53
Thanks for the script.
May if we integreat this in the Configpanel, the customers could make her own backup. They could download it to their pc or send per ftp to their other ftp server.

And when we have a backup import, we do not have any supporttime...


admins

rudolfpietersma
11th September 2009, 01:05
Thanks for the script.
May if we integreat this in the Configpanel, the customers could make her own backup. They could download it to their pc or send per ftp to their other ftp server.

And when we have a backup import, we do not have any supporttime...


admins

Hi there,
Will a backup system be implemented soon? I really need a good backup system.

rudolfpietersma
11th September 2009, 01:06
Hi,
i create litle bash script for remote backup my hosting server.

Script is executed form my home linux server and backup files and database from remote server.

here is link for script:
Remota backup linux server (http://blog.it-podrska.info/2009/08/backup-remote-linux-mysql-and-data/)

Is it possible to backup it to a windows machine?

rudolfpietersma
15th September 2009, 16:59
I mount my win2003 server on /mnt/servername, so I should be able to backup to this folder.

I would like to run this script on the server where the script is installed on. (Because with this script you need 2 servers right?)
I don't want to remote backup a server, what should I change in the script?

I hope it's clear what I would like to do.
Or is there an other script available to backups the local server/ispconfig/db's?

Rudolf.

Franz
15th September 2009, 17:42
i wrote this script for remote backup(for my instalation).

but I can modify script for local use.

rudolfpietersma
15th September 2009, 17:46
It would be great if you can modify it for local use with ispconfig. :-)

Franz
15th September 2009, 20:08
here is script:
on my blog page (http://blog.it-podrska.info/2009/09/update-ispconfig3-backup-script-local-server/)

rudolfpietersma
15th September 2009, 22:02
here is script:
on my blog page (http://blog.it-podrska.info/2009/09/update-ispconfig3-backup-script-local-server/)

Great script Franz!
Tnx a lot for your help!

Franz
15th September 2009, 23:12
Great script Franz!
Tnx a lot for your help!

NP. my pleasure to help.

rudolfpietersma
17th September 2009, 01:18
Franz,
How's the best way to restore the files (if needed)?

rudolfpietersma
17th September 2009, 21:53
I think this doesn't work on ubuntu.

I get this error:
mail: command not found
mail -s"Daily ISPConfig3 backup `date +'%F'`" "$email" < $zamail

This means the script will start at 2.02am every day right?
2 2 * * * /scripts/backupscript.sh

Cheers,
Rudolf.

Franz
17th September 2009, 23:07
I think this doesn't work on ubuntu.

I get this error:



This means the script will start at 2.02am every day right?


Cheers,
Rudolf.

apt-get install mailutils

yes script will be run at 2:02

Franz
17th September 2009, 23:23
Franz,
How's the best way to restore the files (if needed)?

depend what you need.

if you need database restore then copy mysqldump files to server and execute:


bzip2 -d name_of_mysql_dump.bz2

mysql -uusername -ppassword < mysq_database_dump.sql

note: this will replace database on server


for files restore:

copy all *.tar.bz to server, starting with Monday (because Monday is full backup, and rest days are only incremental of day before till sunday which is last day of week)

best way is to extract to temp directory and then move to right location, you can chose which files you need to restore.

to extract file to /ispconfig_restore:
copy all files to /ispconfig_restore folder
and extract one file a time starting with FULLbackup:

tar -xvif name_of_archive_FULL.tar.bz2 -C /ispconfig_restore

and then for Tuesday

tar -xvif name_of_archive_Increment_2.tar.bz2 -C /ispconfig_restore

for wensday:

tar -xvif name_of_archive_Increment_3.tar.bz2 -C /ispconfig_restore


and all files are restored into /ispconfig_restore directory.
and you can move files to original location.

If you need files from (monday) just extract FULL archive.

I hope you will manage to restore :)

rudolfpietersma
24th September 2009, 14:18
Hello,
How can I change Monday as a Full backup day, can I change it?

And how is the best way to move the files to the correct dirs after I unpacked the files in a temp dir?

Tnx,
Rudolf.

Franz
24th September 2009, 15:03
Hello,
How can I change Monday as a Full backup day, can I change it?


I don't understand? Monday is first day of week on linux system.

And how is the best way to move the files to the correct dirs after I unpacked the files in a temp dir?

Tnx,
Rudolf.
if you want to restore whole directory, just move whole directory do system / directory

or just copy/move one file which you need to restore.

rudolfpietersma
24th September 2009, 15:09
I'm having some issues with my server and want to begin from scratch. I learned a lot and want to prevent this by reinstallation.

So I wanted to reinstall my server today and thought maybe it's a good idea and easier to make a full backup today before my reinstallation of the server.

But no problem I will wait untill next week to reinstall the server. Or do it later and use the incremental backups.

Tnx,
Rudolf.
(A linux Noob :-)

rudolfpietersma
24th September 2009, 15:13
One other thing/question:
When I do this reinstallation of my server what's the correct procedure to get back my settings of ispconfig (like sites, email settings, clients etc)? Can you give me some tips?

Rudolf.

Franz
24th September 2009, 15:36
I'm having some issues with my server and want to begin from scratch. I learned a lot and want to prevent this by reinstallation.

So I wanted to reinstall my server today and thought maybe it's a good idea and easier to make a full backup today before my reinstallation of the server.

But no problem I will wait untill next week to reinstall the server. Or do it later and use the incremental backups.

Tnx,
Rudolf.
(A linux Noob :-)
in script replace


DF_X=`date +'%u'`
with

DF_X=1
so it will be always 1. day of week

autogun
2nd October 2009, 02:14
Dear Franz,

Thank you so much for this wonderful script, doing exactly what I've been looking for..

One tweak is needed tho,
Since my remote server is set to "PermitRootLogin no", im unable to log-in as root and running the script under different user output lots of "Premission denied"..

Can this script somehow be tweaked to use sudoer in order to gain root access?

Thanks a bunch in advance!

Franz
2nd October 2009, 10:30
Yes, add user to sudoers file with NOPASSWD option, and all comands start with
sudo command

rudolfpietersma
3rd October 2009, 17:33
How to make a backup from / ? (so the whole system).
I only have total / in the lista.txt file but it doesn't seem to work. Last night it only backupped the databases.

rudolfpietersma
5th October 2009, 11:32
Another question. What if I want this script to backup to a local folder? Is this a possibility?

rudolfpietersma
14th October 2009, 10:12
Another question. What if I want this script to backup to a local folder? Is this a possibility?


I guess just changing the path=/backupfolderlocal in Franz his script will do it to backup locally.

My idea was to colocate 2 servers in the datacenter, but for the beginning this is to expensive for me. So I will start with colocate 1 server in the datacenter, create the backups in a local folder and copy them to the computer at home.

Any other suggestions are welcome :-)

Rudolf.

rudolfpietersma
14th October 2009, 10:17
Backups are finished, just checked, all files have been written to the local folder. But at the end the script gives me this error:

Cannot parse address `2009-10-14 09:14:47 - Starting daily backup' (while expanding `2009-10-14 09:14:47 - Starting daily backup'): Format of RFC822 object is bad

What does it mean?

jcombs_31
5th November 2009, 16:01
The script is works well, but you should fix these lines on your blog

# $SSH $MYSQLDUMP
log "Dump OK. Starting SCP"
# $SCP/mysql-$i-$datum_x.sql.bz2 $dirname/

you have them commented out.

Some syntax indentation would make it more readable.