I am the web administrator for a small company. We host our website on our own server. The site runs on PHP and MySQL. I access the server via SSH.

I am not very familiar with UNIX/LINUX commands, but I was given instructions by the previous web administrator on how to back up the website. Basically, I need to export a mysqldump operation to a .sql file on the server, then move it to a local, secure location. I back up the website via the zip operation and download that via FTP.

I do not have access to the Apache server configuration so I cannot enable shell commands in PHP. However, I would like to write some kind of simple batch-style program that can access the shell, log in, and run a series of commands automatically. Then the administrator can simply download those files off (or, better yet, the downloading process could be automated as well).

Is this even possible? If so, could you direct me to where to start to learn about something like this? I don't even know what to search for.

Thanks so much.

  • 2
    Do you have the rights to create a cron job? Jun 12, 2012 at 20:28
  • Sure its' possible, but it's way easier if you have command line access -- any way you can get that access?
    – voretaq7
    Jun 12, 2012 at 20:44
  • 1
    A side note: don't forget to test your backups and document how to restore them. I know far too many cases where people just go through the motions, which can lead to a false sense of security. Jun 13, 2012 at 0:21

3 Answers 3


IMO, the easiest solution would be to set up a cron job on server side, that dumps SQL database(-s), copies relevant files, packs that all into archive and moves to FTP folder.
After this is done, the file can be either downloaded manually, or, for example, synchronized to remote machine using rsync.

Some relevant links:


We have a similar set-up. We generate a daily database backup with automysqlbackup. In automysqlbackup you can set a "post-script" which will be called after the mysql backup. In this post-script we have then some rsync commands which are then syncing all files to another server. The AMB is called by a cron job at night.

So our solution is similar to the one Andrejs provided. We just have a special tool for the mysql backup.

AMB can generate an email when the backup job finished. Which is very nice too.


I would agree with the others that setting a cron job and script on the server itself is generally the best option but if it needs to started from your desktop or another machine you can look at using Plink to set up a batch script then set it up in task manager, you should then be able to add FTP to the end of the script or on a separate task.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.