diff options
Diffstat (limited to 'nscaw')
-rwxr-xr-x | nscaw | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -49,6 +49,9 @@ shift 2 # it can be overridden with the value of NSCAW_HOSTNAME if defined hostname=${NSCAW_HOSTNAME:-$(hostname -s)} +# Figure out our username +username=$(whoami) + # Attempt to run command within a time wrapper # <http://mywiki.wooledge.org/BashFAQ/032> exec 3>&1 4>&2 @@ -65,17 +68,17 @@ case $ret in 0) code=0 # OK message=$(printf '%s: `%s` ran with no errors as user %s: %s' \ - "$self" "$*" "$USER" "$time") + "$self" "$*" "$username" "$time") ;; 127) code=3 # UNKNOWN message=$(printf '%s: `%s` could not be found as user %s with PATH=%s' \ - "$self" "$1" "$USER" "$PATH") + "$self" "$1" "$username" "$PATH") ;; *) code=2 # CRITICAL message=$(printf '%s: `%s` ran with errors as user %s: %s' \ - "$self" "$*" "$USER" "$time") + "$self" "$*" "$username" "$time") ;; esac printf '%s\n' "$message" |