[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

logging a bash script using sudo and time



Hi All

I regularly run a script with time and sudo.  e.g.
> time sudo echo 'hi mom'

I've set up the sudoers file so that one script (represented in my
example as `echo`) can be run as sudo by my user account without a
password prompt.

Now I want to log the entire output to a log file as well as display
it on the screen.
> time sudo echo 'hi mom' | tee | logger -f /var/log/hiMom

Only that doesn't work :-)  Time is only on the screen, not in the log
file, and /var/log/hiMom is empty, regardless of the permissions on
that file.

Can someone explain the redirection going on here in a way I can grok?

Brian


Reply to: