/bin/sh: root: command not found

Crontab errors and solutions, and empty mail queue after

/bin/sh: root: command not found



When we get this error cron is trying to execute a command with the name "root", which does not exist.

This is because cron expects a command in the sixth field.


If you are making changes in a local cron file using crontab -e, the job entry should contain 6 fields (not the username)
like this:

* * * * * /home/myfolder/myshell.sh

A wrong entry like this:
* * * * * root /home/myfolder/myshell.sh

would cause cron to interpret "root" as a command.

The syntax "* * * * * root /home/myfolder/myshell.sh" is valid for system crontab file /etc/crontab.

 

Then it migh happen that all this error messages filled up the mail queue.

 

Check:

 

mailq -v

To check how many pending mail you have

 

 

Launch this command:

 

cat /dev/null > /var/mail/root

And it will delete all mail from user root.

 

If you need a command line mail client to check up things you can use mutt.


Just type:

mutt