I installed it in a machine at work and it wouldn't do anything, no matter what I did. So now I have it on virtualbox at home and it also doesn't work. Here's what I'm trying to do:
Have a file on /home/john/Desktop called test.sh. Its contents:
#!/bin/bash
echo "Bing!" > /tmp/cronjob
Have done a chmod 777 test.sh
and can run it. Listing it shows as rwx for users/group/global. Then I do a crontab -e
and add the following line:
* * * * * john /home/john/Desktop/test.sh
But it doesn't work. The file is never written. I've also tried using a specific time (for example, it's 9 PM so I set the hour to 05 21 and wait) but it doesn't work as well. I've also tried without the user "john" in the crontab but no dice. I tried using crontab -e -u john
too. Nothing works.
Doing a service cron status
I get that it is started/running. I've tried restarting it as well.
What am I doing wrong?
Also, if I need to run some commands as root I'm supposed to use it with crontab -e -u <username> right
?
Best Answer
Just to be sure:
crontab -e
then
EDIT: I mean that you don't need no "john" beside the time section of cron and the path to the command.