Backing up with robo copy
Written below is a simple script I wrote to backup files using RoboCopy along with BLAT and 7zip to zip the log file and send it with an email confirmation. It is very basic and i’m sure there are other ways to do this, but I wanted to have some fun. It requires robocopy, 7zip and BLAT to work correctly.
REQUIRED PROGRAMS:
7zip command line tool:
http://www.7-zip.org/download.html
BLAT emailer:
http://www.blat.net/
After downloading 7zip and BLAT just throw the executables in your c:\windows\system32 folder so they can be accessed easily. I know this isnt the best way to go about it, if you would rather not put them in the system32 folder simply prefix the commands with their respective location.
@echo off rem LET GET SOME THINGS OUT OF THE WAY BEFORE THE GOOD STUFF rem SETS THE DATE VARIABLE set mm=%DATE:~4,2% set dd=%DATE:~7,2% set yyyy=%DATE:~10,4% rem date variable to use for anything you want the date inserted: %yyyy%-%mm%-%dd% rem *********************************************************************** rem SET THE BACKUP SOURCE AND DESTINATION DIRECTORIES rem *********************************************************************** set source1=C:\ set destination1=e:\ set source2=C:\ set destination2=e:\ set source3=C:\ set destination3=e:\ set source4=D:\ set destination4=E:\ set source5=D:\ set destination5=E:\ set source6=D:\ set destination6=e:\ set source7=D:\ set destination7=E:\ set source8=D:\ set destination8=E:\ set source9=D:\ set destination9=E:\ set source10=D:\ set destination10=E:\ set source11=D:\ set destination11=E:\ set source12=D:\ set destination12=E:\ rem ************************************************************************ rem LOG FILE SETTINGS rem ************************************************************************ rem ROOT FILE LOCATOIN set dir="e:" rem ************************************************************************ rem EMAIL SETTINGS -- REQUIRES BLAT EMAILER http://blat.net rem ************************************************************************ rem SUBJECT set subj=BACKUP LOG FOR %yyyy%-%mm%-%dd% rem RECIPIENT EMAIL set recip=test@tester.com rem FROM EMAIL ACCOUNT set emailadd=mail@mail.com rem SMTP SERVER set smtps=mail.mail.com rem SMTP USERNAME set smtpu=mail@mail.com rem SMTP PASSWORD set smtpp=emailpass rem *********************************************************************** echo GENERATING LOG FOLDER > con mkdir %dir%\logs\%yyyy%-%mm%-%dd% echo THE PROCESS IS ABOUT TO START... > con msg * /TIME:1 THE PROCESS IS ABOUT TO START... msg * /TIME:1 BACKUP STARTING... echo STARTING BACKUP... rem *********************************************************************** rem Robocopy backups rem *********************************************************************** robocopy "%source1%" "%destination1%" /E /R:5 /W:2 /log+:"%dir%/logs/%yyyy%-%mm%-%dd%/backup.txt" robocopy "%source2%" "%destination2%" /E /R:5 /W:2 /log+:"%dir%/logs/%yyyy%-%mm%-%dd%/backup.txt" robocopy "%source3%" "%destination3%" /E /R:5 /W:2 /log+:"%dir%/logs/%yyyy%-%mm%-%dd%/backup.txt" robocopy "%source4%" "%destination4%" /E /R:5 /W:2 /log+:"%dir%/logs/%yyyy%-%mm%-%dd%/backup.txt" robocopy "%source5%" "%destination5%" /E /R:5 /W:2 /log+:"%dir%/logs/%yyyy%-%mm%-%dd%/backup.txt" robocopy "%source6%" "%destination6%" /E /R:5 /W:2 /log+:"%dir%/logs/%yyyy%-%mm%-%dd%/backup.txt" robocopy "%source7%" "%destination7%" /E /R:5 /W:2 /log+:"%dir%/logs/%yyyy%-%mm%-%dd%/backup.txt" robocopy "%source8%" "%destination8%" /E /R:5 /W:2 /log+:"%dir%/logs/%yyyy%-%mm%-%dd%/backup.txt" robocopy "%source9%" "%destination9%" /E /R:5 /W:2 /log+:"%dir%/logs/%yyyy%-%mm%-%dd%/backup.txt" robocopy "%source10%" "%destination10%" /E /R:5 /W:2 /log+:"%dir%/logs/%yyyy%-%mm%-%dd%/backup.txt" robocopy "%source11%" "%destination11%" /E /R:5 /W:2 /log+:"%dir%/logs/%yyyy%-%mm%-%dd%/backup.txt" robocopy "%source12%" "%destination12%" /E /R:5 /W:2 /log+:"%dir%/logs/%yyyy%-%mm%-%dd%/backup.txt" rem *********************************************************************** echo BACKUP COMPLETE! > con rem BACKUP IS COMPLETE, NOW WE NEED TO ZIP AND SEND THE LOG FILE rem THIS CREATES THE EMAIL WITH THE ATTACHED LOG FILE echo GENERATING EMAIL... > con echo BACKUP COMPLETE FOR %yyyy%-%mm%-%dd%, attached is the log file for the operation. > %dir%\logs\%yyyy%-%mm%-%dd%\email.txt echo COMPRESSING LOG FILE... > con rem *********************************************************************** rem zips the log file, because its probably huge rem *********************************************************************** 7za a -tzip %dir%\logs\%yyyy%-%mm%-%dd%_log.zip %dir%\logs\%yyyy%-%mm%-%dd% echo SENDING LOG FILE > con blat %dir%\logs\%yyyy%-%mm%-%dd%\email.txt -attach %dir%\logs\%yyyy%-%mm%-%dd%_log.zip -to %recip% -f %emailadd% -s "%subj%" -server %smtps% -u %smtpu% -pw %smtpp% echo BACKUP OPERATION COMPLETE! >con msg * /TIME:5 BACKUP OPERATION COMPLETE! Email sent to %recip%
Windows update .NET 4 error 66a
I stumbled across this error today while doing windows updates on several new windows 7 laptops. The error was ”Error 66a” and it prevented me from installing the .NET 4 security patch.
The fix for this little bugger is below.
Click on Start and click on Control panel.
B. Go to Program and Features.
C. Scroll down to Microsoft.Net Framework 4 Client Profile, right click it.
D. It will give you a choice of Uninstall/Change, click it.
E. Then, it will give a choice to Repair it, pick Repair it. It will take about 4-10 minutes to repair (with my PC) your experience may vary.
F. When completed, go to your update center, and update it again
Read MoreRenew Self-Signed SSL Certificate Microsoft Exchange Server 2007
I havn’t worked with Microsoft Exchange Server 2007 much, but today I got thrown into the lions den when a client asked if I could update the SSL certificate because they were getting an error that the certificate was outdated. I searched and searched, but simply could not find the answer I wanted. After an hour, I FINALLY found the solution on microsoft’s technet, the magic line is below.
1) Open up the Exchange Management Shell
2) Type the following -replacing the information for your server below
New-ExchangeCertificate -DomainName “exchange1.domain.com”, “exchange1″ -Services “SMTP”
The console will ask you if you want to replace the existing certificate. Type “Y” and then ENTER.
DONE!
What a relief! I was finally able to continue the mass of other support calls coming in today.
Sources:
http://technet.microsoft.com/en-us/library/bb851505(EXCHG.80).aspx
Ultimate Carputer – The NEXUS Project
I inted to convert my 2003 Chevrolet Silverado into a wandering mass of technology. Follow me as i design and build this hefty project. Below are the features that i intend to include. Though there could be much more capability i will work to obtain the below first.
Hardware:
- EEE PC netbook with SSD and Ubuntu OS
- USB ODB II Interface ($29)
- Relay control system for remote starting ( option 1 Spinneret Webserver, option 2 USB Relay ) (~$50)
- Secondary 12V power system ( If i decide all this technology will leave me stranded in the middle of nowhere with a dead battery)
- USB GPS Reciever ($20)
- Verizon Aircard (tethering with Droidx may eliminate this. -im cheap.)
- Ubnt bullet 2.4 ghz
- External 1 TB HD
- Multiband antenna for gps, wifi and cell booster
- Willson Cellphone Booster
- Logitech HiDef usb camera(s ?)
- Touch LCD Display or Android powered Tablet
Designated Functions
- Remote file sync
- GPS navigation
- Remote Start (keyless unit / web) (Relay system / OBDII Interface)
- Remote Diagnosing (web based) (ODB II USB Interface
- Mobile Hotspot (UBNT pico station HP)
- Wifi leeching (using open wifi)
- Entertainment System (music, videos, games)
- Interface for Android OS
- VOIP (with cab microphone) Skype / Ventrilo (microphone pre-installed)
- Full control of vehicle lights, audio. (USB ODB II Interface / Relay system)
Detecting a DDOS attack
Here are some tips to detect whether you are being DDOS’d
1) SSH into the terminal and type the following
netstat -anp |grep 'tcp\|udp' | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n
This should tell you how many connections each IP has to the server. Anything over 50 is pretty excessive.
2) Check bandwidth graphs
See if your host offers Cacti bandwidth graphs, if they dont, why not install it yourself?
Visit http://www.cacti.net/ for more information
See what the current bandwidth usage is, if it is way higher than normal, obviously there is something going on.
5) See what traffic is going through your server, it could be extremely excessive.
tcpdump -l should only average merely a few lines per second.
type the following and you can try and pick through the data with wireshark.
tcpdump -i <interface> -s 65535 -w <some-file>
Verify file transfer with md5 checksum in linux
Heres the simple version of information ive found on howto verify a file transfer with md5 checksums in linux. (cygwin works too)
cd into the source directory and type the following
find -type f -exec md5sum "{}" \; >> md5source.txt
next, navigtate to your destination and use the following
md5sum -c /path/to/source/md5source.txt
You can also use the diff command to verify the files are the same
diff --recursive /DIR1/ /DIR2/
Posted for personal reference, maybe it will help someone out there.
Later days!
Read More









