Thursday, May 22, 2008

Command Line SendMail Tool

So I'm a technology professional and, like all tech pros (aka "geeks"), I LOVE tech books and tools. This afternoon, I went to BnN (That's Barnes and Noble, for those in Rio Linda), and picked up Windows Administration at the Command Line by John Paul Mueller.

Now, I'm personally on a mission to kill Symantec Backup Exec, it's sort of a hobby of mine, so I'm using a number of F/OSS tools to get that done. A lot of those tools are command-line, such as Robocopy from the Windows Server 2003 Resource Kit, or Linux-based such as RESTORE.

One thing I was looking for was a light-weight SendMail type of application, without all of the overhead of SendMail. I found it in SendEmail. This nifty little app allows you to quickly send a text-based email message. You simply drop into one of your Path folders in Windows, set it up with the necessary parameters in a batch file, and the SendEmail app takes over from there.

So how am I using this with my backups? Well, I have Robocopy doing backups of critical data to a backup server with a SAN connection. Each individual server runs a batch script on a schedule that robocopies data to the appropriate folder on the Backup server. In the batch file, I have a sendemail snippet that notifies when the job begins, then the robocopy does it's thing, then the another sendemail notice telling me it's done, and a pause so that the cmd window waits for input.

Why the pause at the end? This way I or one of my guys has to log into each server every morning to confirm that the backup job ran and is complete. The robocopy also writes a log file, telling me where the errors are located, if any, so we just resolve the errors and we're ready for the next day's backup.

Pretty cool, eh? Critial backups, performed every day, on a schedule, with notifications, and NO BACKUP EXEC! We also use RESTORE to make snapshots, for archival purposes, but I haven't quite gotten that tweaked completely out yet.

More on that next time...

1 comment:

Anonymous said...

Hey Gary, I can't remember if I told you before, but I do remote backups for clients and I've been tweaking my program quite a bit in the past 2 months. It's all scripted in a batch file and at the core I run a *nix utility called rsync. I know you're a little more into Linux than I am so if you're willing to use some Linux utilities I'm surprised you aren't using this one. I started out running DeltaCopy which is a GUI for rsync but now I just use rsync right from the command line. It runs under the Cygwin libraries which is about 7 .dlls. The beauty of it is all of the copying is done by delta, so only the changed bits are transferred across the network (or across VPN/WAN in my case). I can backup a 2 GB differential file in under an hour. I generally run an NTBackup job on the client server to grab the system state and compress the files and then run the copy across an automated VPN. It works very well and there isn't much out there that is more efficient, and I've looked at Robocopy and many others. If you're interested in learning more, let me know and I'll email you offline.