Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to make crontab run a sh script every 5 minutes.

This is my root (sudo crontab -e) crontab setup:

*/5 * * * * /etc/

and this is the script:

echo "time:$(date)"

EDIT: i've made it work by using the user crontab file (crontab -e) but I still need to run my script with administrative privileges...

share|improve this question
Did you make your script executable? – troylatroy Jan 8 '14 at 19:18
Where do you expect the output of the echo command to go? The cron process does not run in a terminal (in particular it does not run in the terminal from which you invoked the crontab command). If you look in /var/log/syslog you will probably find a log entry confirming that the job did in fact run (provided the script is executable). – steeldriver Jan 8 '14 at 22:13
executable scripts shouldn't be kept in /etc - that folder is for configuration files. /usr/local/bin would be a much better choice. – ImaginaryRobots Jan 8 '14 at 22:24

First make sure your script is executable! If so, it can also be because PATH is not set, have a look at this post and its replies:
Reasons why crontab does not work

Also my suggestion would be using cron.d instead of making a mess in crontab file.

share|improve this answer

If you want a notification in a balloon at the upper right of youe screen where all the other notifications show up, try this command:

 notify-send "$(date)"
share|improve this answer
I'm using ubuntu server so it'll not work – user2702899 Jan 8 '14 at 19:35
Right you are. I guessed you were the more traditional desktop user. – Marc Jan 8 '14 at 21:01

This doesn't solve the problem the way you wanted to, but it just might git'r'done anyway.

PS1="(\$(date +%H:%M) $PS1"

That will put the time in hour:minute format into your shell prompt. Hit {Enter} on an empty prompt, get the time. Works just dandy on my servers.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.