NICHE OF ONE Ticom's Cyber-Tek Zine Follow
Ticom's Cyber-Tek Zine

At the Day Job - Automating Boring Stuff

I don’t talk much about the technical specifics at the day job because it’s mostly mundane and boring. That’s the case with 80-90% of what you will do at your average STEM job. You want to get paid to do really cool stuff, you need to go work at someplace like BBN/Raytheon or DARPA, you need an interesting resume to do it, and you’ll probably start in continuing engineering where you’ll be doing the follow-up work on someone else’s cool shit. Most of you will just be writing boilerplate code for PHP/SQL/Java, dealing with designs that aren’t much different than what you’d find in a Mims scrapbook. or working in IT or tech support. A lot of IRL day job computer stuff is boring, because that is its purpose: automate the boring, repetitive stuff. A few days ago, I had to automate something repetitive and boring. Needed to check basic connectivity on a device over a period of time. Had Co-Pilot write up a quick Windows command line script to do it:


@echo off setlocal enabledelayedexpansion

:: IP Address to monitor set IP=10.100.10.238

:: Duration in seconds (1 hour = 3600 seconds) set DURATION=3600

:: Log file set LOGFILE=PingLog.txt

echo Monitoring %IP% for %DURATION% seconds… echo Started: %date% %time% > %LOGFILE%

set COUNT=0 set LOSSES=0

:LOOP ping -n 1 %IP% | find “TTL=” >nul

if errorlevel 1 ( echo [%date% %time%] PING LOST! echo [%date% %time%] PING LOST! >> %LOGFILE% set /a LOSSES+=1 ) else ( echo [%date% %time%] Ping OK )

timeout /t 1 /nobreak >nul

set /a COUNT+=1

if !COUNT! LSS %DURATION% goto LOOP

echo. echo Monitoring Complete echo Total Lost Pings: !LOSSES! echo Finished: %date% %time% >> %LOGFILE% echo Total Lost Pings: !LOSSES! >> %LOGFILE%

pause


It’s nothing special, but it got the job done. Why did I use a simple Windows command line batch file? Because that’s what was available, and it served its intended function.

Download PDF ↓

Related

More from Thomas Icom - "Ticom"

Type to search this space. ↑↓ move · ↵ open · Esc close