Sponsored Content
Top Forums Shell Programming and Scripting Piping the "script" command through the logger command. Post 302852869 by Corona688 on Thursday 12th of September 2013 02:12:57 PM
Old 09-12-2013
I'm not sure it's 100% perfect. You should test it and make sure it's killing the logging processes correctly on logout.

Code:
if [ -z $PS1 ]
  then
        :
  else
    DATE="/bin/date"  SCRIPT="/usr/bin/script"
    LOGBASE="/log/cmdline_logs"
       if [ -d "${LOGBASE}" ]; then
           TIMESTAMP="$( ${DATE} +%Y%m%d%H%M%S )"
           LOGFILE="${LOGBASE}/${HOSTNAME}_${USER}_${TIMESTAMP}"
           umask 077
           [[ "${SHELL}" = "/bin/bash" && -e "${HOME}/.bash_profile" ]] && . ${HOME}/.bash_profile

                : > $LOGFILE.log
                ( tail -f $LOGFILE.log | /bin/logger ) &

                trap "kill $!" EXIT # Kill the logger subshell on exit

                ${SCRIPT} -a -f -q ${LOGFILE}.log

           [[ "${SHELL}" = "/bin/bash" && -e "${HOME}/.bash_logout" ]] && . ${HOME}/.bash_logout
           exit
       fi
fi

This User Gave Thanks to Corona688 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to distinguish between "command not found" and "command with no result"

system() call imeplemented in solaris is such a way that: Command not found - return code 1 Command executed successfully without Output - return code 1 how to distinguish between these two based on return code in a c - file? Can you help on this ? (5 Replies)
Discussion started by: iitmadhu
5 Replies

2. UNIX for Dummies Questions & Answers

how to install "source" command!/ broken "login.cl"!

Hello, I am new to this forums and this is my first "asking help" message! i have 2 problems: 1- for unknown reasons the "source" command is not avalable in my system (UBUNTU). i can't either see it in my bin directory! 2- again for unknown reasons the "login.cl" file in the home... (0 Replies)
Discussion started by: astrosona
0 Replies

3. UNIX for Dummies Questions & Answers

Command Character size limit in the "sh" and "bourne" shell

Hi!!.. I would like to know what is maximum character size for a command in the "sh" or "bourne" shell? Thanks in advance.. Roshan. (1 Reply)
Discussion started by: Roshan1286
1 Replies

4. UNIX for Advanced & Expert Users

Command Character size limit in the "sh" and "bourne" shell

Hi!!.. I would like to know what is maximum character size for a command in the "sh" or "bourne" shell? Thanks in advance.. Roshan. (1 Reply)
Discussion started by: Roshan1286
1 Replies

5. Shell Programming and Scripting

Command Character size limit in the "sh" and "bourne" shell

Hi!!.. I would like to know what is maximum character size for a command in the "sh" or "bourne" shell? Thanks in advance.. Roshan. (1 Reply)
Discussion started by: Roshan1286
1 Replies

6. UNIX for Dummies Questions & Answers

the meaning of "!:*" in "alias foo 'command\!:*' filename"

Hi: How can I remove my own post? Thanks. (2 Replies)
Discussion started by: phil518
2 Replies

7. UNIX for Dummies Questions & Answers

Explanation of "total" field in "ls -l" command output

When I do a listing in one particular directory (ls -al) I get: total 43456 drwxrwxrwx 2 root root 4096 drwxrwxrwx 3 root root 4096 -rwxrwxr-x 1 nobody nobody 3701594 -rwxrwxr-x 1 nobody nobody 3108510 -rwxrwxr-x 1 nobody nobody 3070580 -rwxrwxr-x 1 nobody nobody 3099733 -rwxrwxr-x 1... (1 Reply)
Discussion started by: proactiveaditya
1 Replies

8. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

9. UNIX for Dummies Questions & Answers

Unix "look" Command "File too large" Error Message

I am trying to find lines in a text file larger than 3 Gb that start with a given string. My command looks like this: $ look "string" "/home/patrick/filename.txt" However, this gives me the following message: "look: /home/patrick/filename.txt: File too large" So, I have two... (14 Replies)
Discussion started by: shishong
14 Replies

10. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies
Glusterd(8)							   Gluster Inc. 						       Glusterd(8)

NAME
Glusterd - Gluster elastic volume management daemon SYNOPSIS
glusterd [OPTION...] DESCRIPTION
The glusterd daemon is used for elastic volume management. The daemon must be run on all export servers. OPTIONS
Basic options -l <LOGFILE>, --log-file=<LOGFILE> File to use for logging. -L <LOGLEVEL>, --log-level=<LOGLEVEL> Logging severity. Valid options are TRACE, DEBUG, INFO, WARNING, ERROR and CRITICAL (the default is INFO). --debug Run the program in debug mode. This option sets --no-daemon, --log-level to DEBUG and --log-file to console. -N, --no-daemon Run the program in the foreground. Miscellaneous Options: -?, --help Display this help. --usage Display a short usage message. -V, --version Print the program version. FILES
/var/lib/glusterd/* SEE ALSO
fusermount(1), mount.glusterfs(8), glusterfs(8), gluster(8) COPYRIGHT
Copyright(c) 2006-2011 Gluster, Inc. <http://www.gluster.com> 07 March 2011 Gluster elastic volume management daemon Glusterd(8)
All times are GMT -4. The time now is 05:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy