/bin/sh: line 1: root: command not found

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.

Popular posts from this blog

Planning for Learning or Planning for Behaviour?

My Leadership Story

And what if we don't achieve our dreams?