Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Programming/Scripts

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Thread Tools Display Modes
Old 12th September 2013, 20:40
woodson2 woodson2 is offline
Junior Member
Join Date: Nov 2008
Posts: 9
Thanks: 0
Thanked 1 Time in 1 Post
Default Piping the "script" command through the logger command.

I use the snippet below in /etc/profile on RHEL Linux to capture command line logging and it all works well and good.

Now I'd like to pipe the same output from script through the logger command so it all gets logged to syslog.

The only additional code I've added is in bold below (| bin/logger).

This works as expected sans one issue, albeit a major one. My terminal session is blank as if nothing is being typed, however if I type commands I can see them being logged and if I type exit my session closes. I tried a nohup and & to see if that would help but it does not. I'm wondering why I can no longer see anything on my tty.

This is what my putty session looks like. So I have a fully functional session but I can't see any output.
[user@test1 ~]$ ssh cxxx
user@test1's password:
Last login: Thu Sep 12 09:56:01 2013 from 10.x.x.x

if [ -z $PS1 ]
    echo "" > /dev/null
    DATE="/bin/date"  SCRIPT="/usr/bin/script"
       if [ -d "${LOGBASE}" ]; then
           TIMESTAMP="$( ${DATE} +%Y%m%d%H%M%S )"
           umask 077
           [[ "${SHELL}" = "/bin/bash" && -e "${HOME}/.bash_profile" ]] && . ${HOME}/.bash_profile
           ${SCRIPT} -f -q ${LOGFILE}.log | /bin/logger
           [[ "${SHELL}" = "/bin/bash" && -e "${HOME}/.bash_logout" ]] && . ${HOME}/.bash_logout
Reply With Quote
Sponsored Links


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mail hold in Q fisherofer Installation/Configuration 1 5th February 2012 14:29
Can't receive mails baicunko Server Operation 12 3rd August 2011 23:02
Postfix queue problem? murunix Server Operation 7 2nd May 2011 02:55
proFTPd passive mode problems bisbell Server Operation 8 6th August 2008 22:12
help on /etc/rc0.d/K20dnsctl -> ../init.d/dnsctl zimele General 13 23rd August 2006 17:06

All times are GMT +2. The time now is 06:24.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.