What I'm Doing...

Posting tweet...

Powered by Twitter Tools.



I’ve just spent a while trying to figure out why my cron job was throwing this error. Here’s the problem:

I had something like this in my user crontab:

1 4 * * * root command.sh

This is doomed, for several reasons. Firstly, it doesn’t make sense for a user to be able to run something as root without “sudo”. If that were possible, it would totally compromise root! Secondly, user cron jobs don’t have the “user” element in their syntax. So cron is trying to run the command “root” rather than running something as root.

The answer is to su then put the quoted crontab line into root’s crontab.

Job done :) Obvious once I took the time to think about it.

Stumble it!

Tags: , , ,



0 Responses to “/bin/sh: line 1: root: command not found”

  1. No Comments

Leave a Reply


I like comments! Anonymous comments are fine, but I prefer to know who I'm talking to.
Avoid personal attacks and offensive stuff.


XHTML: You can use these tags <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> :





Subscribe to Email Feed

Enter your Email


Preview | Powered by FeedBlitz

My Photos

www.flickr.com
This is a Flickr badge showing public photos from Robert M Jones. Make your own badge here.
3K2 theme by Hakan Aydin