Daily maintenance

Smoot Carl-Mitchell smoot at tic.com
Fri Jun 20 12:42:53 UTC 2008


On Thu, 2008-06-19 at 13:14 -0300, Derek Broughton wrote:

> LOL.  I never even thought about it.  This runs from /etc/cron.weekly, so it
> runs as root, and wouldn't need sudo anyway!  It _does_ have to be able to
> write (in my case) into /etc, which is probably why there's a "sudo" in it. 
> otoh, ime, "sudo" never worked for redirecting output.

cron jobs run as root, so the sudo is redundant.

You can do this, if you need shell redirection when running sudo:

sudo sh -c "echo hello >zzz"

Quoting can get a little convoluted with a complex command, but if the
command is that complex then write a script and call the script with
sudo. In this case the redirect is handled by the invoked shell which is
running as root.
-- 
Smoot Carl-Mitchell
System/Network Architect
smoot at tic.com
+1 480 922 7313
cell: +1 602 421 9005




More information about the ubuntu-users mailing list