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

Re: logging a bash script using sudo and time



Am 2008-09-24 09:59:26, schrieb Brian McKee:
> 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?


    time sudo (echo 'hi mom' | tee | logger -f /var/log/hiMom)


Thanks, Greetings and nice Day/Evening
    Michelle Konzack
    Systemadministrator
    24V Electronic Engineer
    Tamay Dogan Network
    Debian GNU/Linux Consultant


-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
##################### Debian GNU/Linux Consultant #####################
Michelle Konzack   Apt. 917                  ICQ #328449886
+49/177/9351947    50, rue de Soultz         MSN LinuxMichi
+33/6/61925193     67100 Strasbourg/France   IRC #Debian (irc.icq.com)

Attachment: signature.pgp
Description: Digital signature


Reply to: