Hosting on Android: Backing up by cloning to external SD card?
I'm hosting a small website on a pretty budget android tablet. If it were to fail, I would essentially lose my files. To get around this, I'm thinking of using PHP copy(); to clone the main directory to the tablet's SD card at my request.
Is this a good idea, or not? What are the risks? While this is happening, will PHP still continue to run other scripts?
The directory that will be cloned only contains the webpages, all of the images have been moved into another folder.
Here is how I am planning to accomplish it:
include("adminverify.php");
if(isset($_GET["websiteBackup"]) && $admin=true)
{
$sdcard = "/mnt/extsdcard";
$sourcefile = "/internal/www";
// Write to a file saying the backup has started
copy($sourcefile, $sdcard) or die("Could not be done");
// Write to a file saying the backup has finished
}
Alternatives are welcome. I would simply go on the tablet myself and copy the files over, but the tablet is honestly too laggy.
If it turns out PHP is not able to function while doing the backup, I will simply have it change the directory name and modify the 404 page to say that the website is temporarily unavailable.
If this helps, I'm using lighttpd and PHP 5.5.15
链接地址: http://www.djcxy.com/p/93600.html