#!/bin/sh #------------------------------------------------------------------------------ # logmsg - log a message or stdin to syslog if available, else to the console # # Last Update: $Id$ #------------------------------------------------------------------------------ # $1 = tag # $2 = priority # $3 = message; if empty, the message is read from stdin if [ -f /var/run/syslogd.pid ] then [ -n "$1" ] && tag="-t $1" || tag= [ -n "$2" ] && prio="-p $2" || prio= if [ -n "$3" ] then exec logger $tag $prio "$3" else exec logger $tag $prio fi else [ -n "$1" ] && tag="$1: " || tag= if [ -n "$3" ] then echo "$tag$3" else while read line; do echo "$tag$line" done fi >/dev/console fi