#!/bin/sh

. /etc/blackPanther-default-apps.conf
#*********************************************************************************************************
#*   __     __               __     ______                __   __                      _______ _______   *
#*  |  |--.|  |.---.-..----.|  |--.|   __ \.---.-..-----.|  |_|  |--..-----..----.    |       |     __|  *
#*  |  _  ||  ||  _  ||  __||    < |    __/|  _  ||     ||   _|     ||  -__||   _|    |   -   |__     |  *
#*  |_____||__||___._||____||__|__||___|   |___._||__|__||____|__|__||_____||__|      |_______|_______|  *
#* http://www.blackpantheros.eu | http://www.blackpanther.hu - kbarcza[]blackpanther.hu * Charles Barcza *
#*************************************************************************************(c)2002-2011********
export PATH=$PATH:/usr/sbin:/sbin

case $LANG in 
	hu*) 
	header="rendszernalpó mutatása...[Kilépés a Ctrl+C gombok együttes lenyomásával lehetséges]"
	notrun="
	* A napló démonja nem fut. Ahhoz, hogy meg tudja nézni most elindításra kerül...
	"
	notroot=$notroot_hu
	helptxt="${GRN}
	Ehhez a programhoz nincs szükség semmilyen segítségre, egyszerűen futtassa a programot
	és a rendszernapló megjelenik az aktív konzolon.
	Kilépés a Ctrl+C gombok együttes lenyomásával lehetséges
	
	A blackPanther Fejlesztői.${DEF}
	"
	;;
	*) 
	header="show system logs...[Press Ctrl+C keys for exit]"
	notrun="
	* The daemon of log does not run. Now start daemon for you show ...
	"
	notroot=$notroot_en
	helptxt="${GRN}
	Not needed any help for this application. Please simple run application
	for show the system-log.
	
	Press Ctrl+C keys for exit
	The blackPanther Developers.${DEF}
	"
	;;
esac

if [ "$1" == "--usage" -o "$1" == "--segits" -o "$1" == "--help" ];then
    echo -e "$helptxt"
        exit
fi


if [ $UID != 0 ];then 
    echo -e "$RED $notroot $DEF"
    echo -n "  * "
    su - -c $0
    echo ""
 exit 
fi

syslog=$(echo `which rsyslog 2>/dev/null ||which syslog-ng 2>/dev/null || which ksyslogd 2>/dev/null` | awk -Fn/ '{print $2}')
service $syslog status 2>/dev/null || daemon=OFF
if [ "$daemon" = "OFF" ];then
    clear
    echo "$notrun"
    sleep 3
    service $syslog start
fi

logshow=`which multitail 2>/dev/null | which tail 2>/dev/null`

showder=`echo $logshow | awk -Fbin/  '{ print $2 }'`
clear


    echo ""
    echo "	* `cat /etc/blackPanther-release | sed 's|).*|)|'` $header"
    echo ""


if [ "$showder" = "multitail" ];then
    multitail /var/log/syslog
elif [ "$showder" = "tail" ];then
    tail -f /var/log/syslog
fi

