![]() |
|
Backup & Pull backup from server [TUT] - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Computing (https://hackforums.net/forumdisplay.php?fid=88) +---- Forum: Linux (https://hackforums.net/forumdisplay.php?fid=85) +---- Thread: Backup & Pull backup from server [TUT] (/showthread.php?tid=2966127) |
Backup & Pull backup from server [TUT] - Loki123 - Oct 23, 2012 I'm bored, lets start. We are going to, take a backup of /var/www & Mysql, put it all in a tar.xz file, then pull it away from the server. Let's start. What you need :
Take a backup, and tell the script to put it where ever you wan't... For my script I cronjob it like this PHP Code You can also do --help for information on what that does & more does... this does it automatic at 06:30AM every day. Ok, then you can run this on your local PC in cron : PHP Code Also only take the files that are missing from your backup/storage on the PC... You can add "--delete" after "-zavrR" to delete files after the copy. To install a cronjob you run this line : PHP Code Have fun. 😑 * - Fa-koff - Oct 23, 2012 Nice! Thanks for leading by example. * - Loki123 - Oct 23, 2012 (Oct 23, 2012 03:46 PM)Fa-koff Wrote: Nice! Thanks for leading by example. hummm, i forgot to post in the TUT where you put the cronjob line ... 🤐 Fixxed * - NeyZ - Oct 23, 2012 Any idea to add the key part so it becomes fully automatic and don't have to enter the password everytime. Rsync is awesome, using it on all my 14 servers. Also, the --delete option doesn't delete the files on the main pc, only on the backup server when it is removed on the main pc. If I was right. * - Gent - Oct 24, 2012 (Oct 23, 2012 11:25 PM)NeyZ Wrote: Any idea to add the key part so it becomes fully automatic and don't have to enter the password everytime. Rsync is awesome, using it on all my 14 servers. Edit your sshd_config file and disable PAM and password authetication. Code PasswordAuthentication no* - NeyZ - Oct 24, 2012 But than you won't be able to log onto your server without a key added to your server. * - Gent - Oct 24, 2012 (Oct 24, 2012 02:26 AM)NeyZ Wrote: But than you won't be able to log onto your server without a key added to your server. Isn't that the point? Code On local machine:Do what I said above after doing this. Just copy your .ssh directory to the home directory of the user you wish to enable remote connections for. To connect from other machines, just put the key in ~/.ssh on the machine you're trying to connect from. Code chown -R user:group /home/user/.sshDo this after copying it. * - NeyZ - Oct 24, 2012 Ohhh like that, nah I know how it works. I tought you forget to add the key. But it wasn't your plan to put that in your post at all. Nothing said ;) * - Loki123 - Oct 24, 2012 (Oct 23, 2012 11:25 PM)NeyZ Wrote: Also, the --delete option doesn't delete the files on the main pc, only on the backup server when it is removed on the main pc. If I was right. That is the meaning of what I said, it would not even make sense to delete files that you just put on your local machine. 🤦♂ * - NeyZ - Oct 25, 2012 True, however I tought you meant that it deletes the files on your main machine and not the backup machine. |