denglund1996 Posted December 31, 2005 Share Posted December 31, 2005 Is there a way to use Cron to backup files (not a db) that are created by my Movable Type program? I have a number of my MT templates "linked to file" in a subdirectory of my site that I use to store them as backups. But there are some templates where I've specified the "link to file" to a different location that's in the root of my weblog site (I use these as sidebar includes). How can I create a Cron job to copy these template files in their current location to my templates backup directory with the others? I tried this as the "Command to run" line... >cp /home/<name>/www/somefile.php; /home/<name>/www/BkUps/somefile.php But that didn't get me anywhere. I'm afraid I know next to nothing about Cron and/or Unix commands. Can someone get me on the right track? Quote Link to comment Share on other sites More sharing options...
TCH-Andy Posted December 31, 2005 Share Posted December 31, 2005 I'm not sure I fully understand what you are after. Do you want to copy (backup) just these files on a regular basis ? Or is this a once only copy? Quote Link to comment Share on other sites More sharing options...
TCH-Bruce Posted December 31, 2005 Share Posted December 31, 2005 Why do you have a semi-colon between the copy-from and copy-to folder? Have you tried? >cp /home/<name>/www/somefile.php /home/<name>/www/BkUps And I am curious of why you want to do this on a regular basis too. I store backup copies of my changed files on my own computer not somewhere else in my web space. Quote Link to comment Share on other sites More sharing options...
denglund1996 Posted January 1, 2006 Author Share Posted January 1, 2006 Why do you have a semi-colon between the copy-from and copy-to folder? Have you tried? >cp /home/<name>/www/somefile.php /home/<name>/www/BkUps And I am curious of why you want to do this on a regular basis too. I store backup copies of my changed files on my own computer not somewhere else in my web space. To address Andy's question...I want to back them up automatically on a regular basis. But since there is a chance I could be over-writing good with bad (my site was recently hacked), the best thing would probably be to back them up incrementally - that is, not just overwrite yesterday's backup but give each a new backup name (include the current date in the filename?). To address Bruce's question...as mentioned above, on or about December 23 my site was hacked . I found spurious links in my pages and even an embedded virus on one of them. And it looks like they accomplished this because I had files with incorrect permissions set (MT saved these template files as 666). So I had the site restored and have had TCH go through and make sure permissions are set correctly on directories and files. I changed my MT configuration to make use of Umask to set permissions better. And, I also had a guy I work with run a security program against my site and it turned up with no vulnerabilities. So, it seems like its condition of the site is sound at present. I suppose if there were a way to copy these to my local drive that would be even better. But that seems beyond my ability (would require script writing and programming). And I don't know how I'd automate backing up sites on my webspace and copying them to my local drive. Is that even possible? Quote Link to comment Share on other sites More sharing options...
TCH-Bruce Posted January 1, 2006 Share Posted January 1, 2006 Well static content that doesn't change doesn't need backed up except when changes are made. And you just use an FTP program to copy them from the server to your PC. As for the database your blog is using that can be automated to email you a backup every night. I do it with my blog and 3 others using a script called dbsender. I wrote detailed instructions on setting it up. There are also links in that thread worth reading. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.