View Full Version : Backup remote server (ISPconfig host)
Franz
17th August 2009, 01: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, 18: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
skoena
11th September 2009, 00: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.
skoena
11th September 2009, 00: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?
skoena
15th September 2009, 15: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, 16:42
i wrote this script for remote backup(for my instalation).
but I can modify script for local use.
skoena
15th September 2009, 16:46
It would be great if you can modify it for local use with ispconfig. :-)
Franz
15th September 2009, 19:08
here is script:
on my blog page (http://blog.it-podrska.info/2009/09/update-ispconfig3-backup-script-local-server/)
skoena
15th September 2009, 21: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, 22:12
Great script Franz!
Tnx a lot for your help!
NP. my pleasure to help.
skoena
17th September 2009, 00:18
Franz,
How's the best way to restore the files (if needed)?
skoena
17th September 2009, 20: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, 22: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, 22: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 :)
skoena
24th September 2009, 13: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, 14: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.
skoena
24th September 2009, 14: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 :-)
skoena
24th September 2009, 14: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, 14: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, 01: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, 09:30
Yes, add user to sudoers file with NOPASSWD option, and all comands start with
sudo command
skoena
3rd October 2009, 16: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.
skoena
5th October 2009, 10:32
Another question. What if I want this script to backup to a local folder? Is this a possibility?
skoena
14th October 2009, 09: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.
skoena
14th October 2009, 09: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, 15: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.
jonedan
16th December 2009, 10:53
Hey,
That was the ticket Tibor, thanks! Ensuring that both boxes use the same account/password for the SQL Server service did the trick. Backups are now running properly between the servers. Again, many, many thanks!
Franz
16th December 2009, 15:45
Some syntax indentation would make it more readable.
world press remove TABS :(
Castrichella
11th February 2010, 11:39
I want to get a service that allow me to control a remote server and do things like surfing the internet plus installing Windows program.
I think it called dedicated server but I want something cheap per month and surf web using it.
skoena
14th April 2010, 20:09
ssh key authentication
Filed under: Linux tips — admin @ 00:55
How to generate SSH keys and implement for key authentication.
login to local machine with user you will be using for connect to remote.
1. generate keys:
ssh-keygen -t dsa
2. copy id_dsa.pub to remote machine to /tmp directory
scp ~/.ssh/id_dsa.pub remote_machine:/tmp
3. login to remote machine and append new key to authorized_keys2 file in home folder
cat /tmp/id_dsa.pub >> ~/.ssh/authorized_keys2
4. log out and that it is.
You can try with:
ssh remoteuser@remoteserver
and you will be connected to remote server without password.
Hi Franz,
When I want to do step 3 on the remote server
cat /tmp/id_dsa.pub >> ~/.ssh/authorized_keys2
I get this error:
“bash: /.ssh/authorized_keys2: No such file or directory”.
What should I do?
Rudolf.
falko
15th April 2010, 15:21
Are you sure you typed in the ~ before /.ssh/authorized_keys2?
cat /tmp/id_dsa.pub >> ~/.ssh/authorized_keys2
skoena
15th April 2010, 16:26
Yes Falko I did that.
root@backup:/home/administrator# cat /tmp/id_dsa.pub >> ~/.ssh/authorized_keys2
bash: /root/.ssh/authorized_keys2: No such file or directory
root@backup:/home/administrator#
Any ideas to get this fixed?
Rudolf.
falko
16th April 2010, 14:52
What's the output of ls -la /root?
skoena
16th April 2010, 20:51
This is the output:
drwx------ 4 root root 4096 2010-04-14 22:40 .
drwxr-xr-x 22 root root 4096 2010-04-16 18:12 ..
drwx------ 2 root root 4096 2010-04-14 22:42 .aptitude
-rw------- 1 root root 3429 2010-04-16 18:10 .bash_history
-rw-r--r-- 1 root root 2227 2008-12-23 19:53 .bashrc
drwxr-xr-x 2 root root 4096 2010-04-14 22:42 .debtags
-rw-r--r-- 1 root root 140 2007-11-19 18:57 .profile
-rw------- 1 root root 1024 2010-04-14 22:57 .rnd
-rw------- 1 root root 4809 2010-04-14 22:40 .viminfo
falko
17th April 2010, 18:39
Run
mkdir /root/.ssh
chmod 700 /root/.sshThen try again.
skoena
17th April 2010, 23:24
OK got the folder created, tnx Falko.
I use Ubuntu 9.04, how to get this working? I can't seem to connect as root only as admin user.
When I follow the steps on http://blog.it-podrska.info/2009/08/ssh-key-authentication/ and try to connect via ssh it still asks me for a password.
falko
18th April 2010, 18:50
Did you enable the root account (i.e., set a root password)?
Are root logins allowed in your SSH configuration (etc/ssh/sshd_config)?
skoena
18th April 2010, 22:32
Falkon,
In the sshd_config is sais "PermitRootLogin yes" and the root password is set.
falko
19th April 2010, 11:12
Hm... What's root's shell (it's listed in /etc/passwd)?
skoena
19th April 2010, 11:26
Falko,
It's like this:
root:x:0:0:root:/root:/bin/bash
falko
20th April 2010, 14:53
Hm, then it should work. Are you absolutely sure you set a root password with
sudo passwd root?
skoena
20th April 2010, 15:06
Falko,
I set a password on the install of the system.
But I tried it now after "sudo passwd root" and now it seems to work!
Tnx a lot!
Rudolf.
vBulletin® v3.8.7, Copyright ©2000-2013, vBulletin Solutions, Inc.