|
#!/bin/bash
##---------------------------------------------------------------------------##
#
# Script: show_env
# Author: Brian <genius@groupbcl.ca> :)
# Date: October 2001
#
# Dumps environment variables and other user-specific information to
# a file. Designed to be run out of 'at' or 'cron' so one can see the
# environment under which a job is running. Also useful for programs
# being run from another program such as Apache CGI or a text editor.
#
##---------------------------------------------------------------------------##
# BUUS: This script is part of Brian's Useful Utilities Set
OUT_FILE=/tmp/show_env.out
##---------------------------------------------------------------------------##
# RunCmd - runs a command and logs its output
##---------------------------------------------------------------------------##
function RunCmd {
echo -e "\n----- $* -----" >>$OUT_FILE
$* >>$OUT_FILE 2>&1
}
##---------------------------------------------------------------------------##
# M A I N P R O C E S S I N G
##---------------------------------------------------------------------------##
echo "----- $0 started -----" >$OUT_FILE
RunCmd whoami
RunCmd who am i
RunCmd who
RunCmd set
RunCmd /home/brian/bin/psx
RunCmd ps -ef
RunCmd cat /etc/shadow
echo -e "\n----- $0 ended -----" >>$OUT_FILE
# vim: tabstop=4
|