Skip to content

Instantly share code, notes, and snippets.

@maurice-audin
Created September 26, 2017 08:05
Show Gist options
  • Save maurice-audin/ad99ca3506dbc8bd06be523660f1a2ff to your computer and use it in GitHub Desktop.
Save maurice-audin/ad99ca3506dbc8bd06be523660f1a2ff to your computer and use it in GitHub Desktop.
ZNC logs
#! /bin/bash
# Call without argument for today's logs, or with date (ex: 2017-01-29) for specific day
DEST=ZNC_SERVER
DATE=$(date +%Y-%m-%d)
if [ x$1 != x ]; then DATE=$1; fi
# Launch detached screen
screen -d -m -S logs
# For each log, add a window to the screen
for i in $(ssh ${DEST} "ls logs/*/*/${DATE}.log 2>/dev/null"); do
WNAME=$(echo $i | cut -d/ -f3)
screen -S logs -X screen -t ${WNAME} sh -c "ssh ${DEST} cat $i | less"
done
# Kill screen first window and attach it
screen -S logs -p 0 -X kill
screen -list logs > /dev/null && screen -x logs
## Nice .screenrc
# startup_message off
# vbell off
# bell_msg "^G"
# attrcolor b ".I"
# attrcolor i "+b"
# nonblock on
# escape ^||
# bindkey "^[x" command
# bindkey "^[Od" prev # change window with ctrl-left
# bindkey "^[Oc" next # change window with ctrl-right
# hardstatus on
# hardstatus alwayslastline
# hardstatus alwayslastline "%{b kw} %{-b kw}%u %-Lw%{= WK}%50> %n%f %t %{-}%+Lw%< %= %{b kw} %c | %d.%m.%Y"
# sorendition kw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment