Jump to content

Cron Job To Copy Files?


Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 :D. 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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...