1

Firstly, I have the utmost respect for programmers & IT professionals. I'm a newby/wanna-be. I'm looking for help on developing a small program/script that helps me with the task I have detailed below. I am NOT submitting this as homework. This is work-related, but I'm NOT asking you to do my job. I'm taking this as an opportunity to learn more about programming by doing a task that I need done. Any code you may provide will be helpful but I'm very interested in core concepts, steps, and your advice on how best to tackle this task (which tools, language, etc.)

Here's what I have: XP machines (local and remote)

  • Some basic knowledge of batch files
  • A tiny bit of experience with Visual Basic 2008 Express
  • A TINY bit of C++ experience (and have the Code Blocks compiler)
  • A pretty fair working knowledge of XP

Here's what I want to do:

Every Mon-Fri at midnight, I want an offsite machine (#1) that I will set up and can access to

  1. Wake up from hibernate
  2. Copy (or xcopy) a directory (\Server\remoteBackup) with all its contents from a selected machine (#2) at the office (that will be on) through an ftp connection or internet to the offsite machine (C:\remoteBackup)
  3. Put a "successfulCopy.txt"file on another selected machine (#3) (\machine3\log). Each "successfulCopy.txt" file should check to see if exists "successfulCopy.txt" and if so, rename the new to "successfulCopy(2).txt" or whatever.
  4. Go back into hibernate (either when finished or on a timer)

This is basically a remote backup system. What are your thoughts? Any ideas you provide would be most helpful if you name them in a way that I could Google your answer to learn more if I have further questions. I appreciate any help you can provide. I want to do this because I WANT to do this and for no other reason.

6 Answers 6

1

Can't help you with the hibernate side of it, but for copying the files, look into scp and key-based login.

For keeping old versions of the successful copy file, you should be able to use ssh to run commands on the remote end to do that.

You may want to look into cygwin as well; it will give you ssh and bash which may make it easier to do what you want.

1

I wrote up a big post, and I swear I posted it, and yet...Hmmm.

You're going to want to do some kind of archiving: it will make your life so much easier. I recommend 7zip; it's a free zip utility that has a powerful command line interface. Very easy to write a 1-line 7zip command to archive and compress a whole directory tree, and it also supports the "update" option for archives, so instead of wrapping up every file every time, it can just update the changed files...Should save a ton of time.

Once you've got your archive, you'll want to send it somewhere. I recommend WinSCP; it's a free FTP/SFTP client that also has good command line/scripting support. The scripting interface there is quite powerful.

Put those two together, and you can write a simple DOS batch file to run the necessary commands. Quick, simple, and effective.

Try to avoid the temptation to reinvent the wheel. That's a great lesson to learn. There are people out there who have already spent a great deal of time putting together pieces that you can use.

0

It's not exactly what you're asking for, but I'd just use one of the many file copy programs that are available. I use Second Copy myself.

0

There are other and better methods but here is a list of simple ideas that require little knowledge or experience:

  1. You can can normally configure the power settings in the BIOS to wake the machine at a given time, often labeled "Alarm" settings
  2. Rather than copy or xcopy look into Robocopy. It's much more flexible and extremely robust (hence the "robo" part of the name) and can resume interrupted tarnsfers
  3. Robocopy can create a log file but you will have to check it for error message (Perl is ideal for this)
  4. Look into shutdown.exe
0
  1. Wake up an onsite machine - schedule a task (any task) on that machine to wake it up. More at - https://web.archive.org/web/1/http://articles.techrepublic%2ecom%2ecom/5100-10878_11-6073491.html

  2. FTP Script needs to be created on either Source (mput)/Destination (mget) machines, and invoked using a scheduled task. You can find samples of FTP scripts online. Infact you can schedule a FTP GUI Client also to do this, by saving the job within it.

  3. Can be done using the above script/ftp gui client

  4. you could schedule "shutdown.exe -h" or "psshutdown.exe -h" to do this.

Include all of the above in a batch file which is triggered thru a single Scheduled Task, for convenience.

hth's

0

You can also investigate rsync for your task. It is often used for remote backups of directory trees.

You must log in to answer this question.