Click to See Complete Forum and Search --> : Command line for SSH to run backups


rremm2000
04-09-2008, 02:54 AM
I used to have cPanel and it would back up the files and SQL data seperately or together. I'm now on a VPS server with Pesky Plesk which seems to create some un-reliable backups based on a text file/XML

I'm a total newbe when it comes to the SSH I think it's called but I can move around, I got the date on the server once LOL

Anyway I'm On CentOS V4 or V5 can't remember Linux 2.6.9-023stab044.4-enterprise

I'm looking for away to do the same thing that cPanel did with the backups using the command line and get a nice rar or gz file.

Even better is if the backups can be done with PHP on a cron job then I can FTP it. But I would like to learn how to do it with a command line first.

jazz_snob
04-10-2008, 02:24 AM
If you're looking for an automated cron backup for your files and database then you should figure out how to do these by hand at the command line using mysqldump for database backup, for example, and simply tar and mv to backup your files. Then its a matter of deciding if you want to do this from php using execute(), or if you want to learn a new scripting language and code the crons like that (as perl or bash shell scripts, for example).

mysqldump will actually let you specify the order in which tables are dumped. This is important if you actually use foreign keys and want to easily recreate your database from the dumped data.

The best way is of course to have your own linux box to play with. Setting one up builds character, and everyone can use more character building.

Horizon88
04-13-2008, 08:39 PM
This:

tar -czvf backup-$(date +%Y-%m-%d).tar.gz /var/www/html/

Would give you a file named backup-2008-04-13.tar.gz containing the directory /var/www/html. You can modify that to whatever your own path is, then hook it with a cron job, then either SSH or FTP in and download the backups as you need.