LOLCODE for Windows Administration scripts. Useful and amusing.
Everyone loves Easter Eggs. Finally, something useful and stress relieving (I couldn't deal with another batch file!)
//-------------server.lol | module java
HAI
BTW look at SVN
CAN HAS STDIO?
CAN HAS JAVA?
I HAS A bufClass ITZ JAVA "java.lang.StringBuffer"
I HAS A plainText ITZ bufClass!!new
I HAS A html ITZ bufClass!!new
I HAS A dateClass ITZ JAVA "java.util.Date"
I HAS A date ITZ dateClass!!new
I HAS A dateFormatClass ITZ JAVA "java.text.SimpleDateFormat"
I HAS A dateStamp ITZ dateFormatClass!!new WIF "MM/dd/yyyy @ HH::mm::ss Z"
I HAS A server ITZ JAVA "bar.foo.serverhealth.ServerHealth"
HOW DUZ I CHECKSERVER YR srvr
I HAS A tmpServer ITZ server!!checkServer WIF srvr
BOTH SAEM tmpServer AN "OK"
O RLY?
YA RLY
plainText!!append WIF srvr
plainText!!append WIF " | OK\r\n"
html!!append WIF "<tr><td>"
html!!append WIF srvr
html!!append WIF "</td><td>OK</td></tr>"
NO WAI
plainText!!append WIF "ERROR "
plainText!!append WIF srvr
plainText!!append WIF " | "
plainText!!append WIF tmpServer
plainText!!append WIF "\r\n"
html!!append WIF "<tr><td>"
html!!append WIF srvr
html!!append WIF "</td>"
html!!append WIF "<td bgcolor='yellow'>"
html!!append WIF tmpServer
html!!append WIF "</td></tr>"
OIC
IF U SAY SO
BTW This is the header
plainText!!append WIF "Server Health Notification | "
plainText!!append WIF dateStamp!!format WIF date
plainText!!append WIF "\r\n"
html!!append WIF "<html><body><h4>Server Health Notification "
html!!append WIF dateStamp!!format WIF date
html!!append WIF "</h4><table border='1' cellspacing='1' cellpadding='1'><tr><td>URL</td><td>Status</td>"
BTW Set the URLs here...
CHECKSERVER "http:://www.foo.bar"
CHECKSERVER "https:://www.foo.bar/Bank"
CHECKSERVER "http:://application.foo.bar/"
CHECKSERVER "https:://application.foo.bar/JobSystemWeb/"
CHECKSERVER "https:://application.foo.bar/WebSubmission/"
CHECKSERVER "http:://abq.foo.bar/"
CHECKSERVER "https:://abq.foo.bar/Bank/"
html!!append WIF "</table></body></html>"
VISIBLE plainText!!toString
VISIBLE html!!toString
BTW This sends the emails
I HAS A USERNAME ITZ "[email protected]"
I HAS A PASSWORD ITZ "password"
I HAS A PORT ITZ "465"
I HAS A EMAILSERVER ITZ "secure.server.foo"
BTW This is a mail server
server!!setFrom WIF "[email protected]"
server!!setSubject WIF "Server Health Notification"
server!!setMessage WIF plainText!!toString
server!!setHtml WIF html!!toString
server!!setServer WIF EMAILSERVER
server!!setUser WIF USERNAME
server!!setPassword WIF PASSWORD
server!!setPort WIF PORT
server!!sendEmail WIF "[email protected]"
KTHXBYE
(formatted--enjoy, the module is http://www.public.iastate.edu/~bkail/lolcode/)
Posted Aug 27, 2010, 9:38 PM UTC · edited
These are the ramblings of a syphilitic brain, but still preferable to writing batch files =)
Anything, be it COBOL, BRAINFUCK INTERCAL, is preferable to batch files. Fuck. Knowing that the horrid mess called batch files exists gives me the rage.
"Ah, here I am on Windows needing to run this program on this collection of files." BAM, you're fucked.
What about Powershell?
Windows script host. At least you can use Javascript.
I prefer it to batch files, but it's not on every Windows and on those Windowsen that are non-genuine, you can't download it.