Skip to content

Instantly share code, notes, and snippets.

@Strykar
Created September 1, 2016 12:29
Show Gist options
  • Save Strykar/c8926501d7fa0623b657227112384b91 to your computer and use it in GitHub Desktop.
Save Strykar/c8926501d7fa0623b657227112384b91 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Cron script to telnet to ircd and log output of commands so we can run stats
# TODO: Clean this up so it just updates /var/www/htdocs/member/Strykar/images/ircdstats.sh_irc.hackerzlair.org.rrd
MYHOST=localhost
# This is inefficient and needs to change.
# Currently awk-drops first 3 columns and prints server date:time:tz, uptime and connection count
# geckoo www.hackerzlair.org :Tuesday December 18 2012 -- 05:08:54 -06:00
# geckoo :Server Up 62 days, 22:28:41
# geckoo :Highest connection count: 11 (9 clients) (381 connections received)
( echo NICK geckoo ; echo 'USER strykar 8 * :strykar' ; echo OPER geckoo OPERPassHERE ; echo TIME ; echo STATS u ; echo QUIT :Done ; sleep 10 ) | telnet $MYHOST 6667 | awk '{ print substr($0, index($0,$3)) }' | grep -A 1 -B 1 -w ":Server Up" >> /home/strykar/scripts/logs/ircd_result.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment