#!/bin/bash # ---------------------------------------------------------------------- # File: eos-tty-broadcast # Author: Andreas-Joachim Peters - CERN # ---------------------------------------------------------------------- # ************************************************************************ # * EOS - the CERN Disk Storage System * # * Copyright (C) 2011 CERN/Switzerland * # * * # * This program is free software: you can redistribute it and/or modify * # * it under the terms of the GNU General Public License as published by * # * the Free Software Foundation, either version 3 of the License, or * # * (at your option) any later version. * # * * # * This program is distributed in the hope that it will be useful, * # * but WITHOUT ANY WARRANTY; without even the implied warranty of * # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * # * GNU General Public License for more details. * # * * # * You should have received a copy of the GNU General Public License * # * along with this program. If not, see .* # ************************************************************************ tail -f $1 | while read line || [[ -n "$line" ]];do msg=`echo $line | egrep "$2"` if [ -n "$msg" ]; then for name in `ls /dev/pts/[0-9]*`; do alrt=`echo $line | egrep ALERT`; progress=`echo $line | egrep PROGRESS`; if [ -n "$alrt" ]; then echo -n -e "\n\033[47;34m\e[5m" "$msg" "\033[0m " > $name else if [ -n "$progress" ]; then echo -n -e "\n\033[47;32m\e[5m" "$msg" "\033[0m " > $name else echo -n -e "\n\033[47;31m\e[5m" "$msg" "\033[0m " > $name fi fi done fi done