Indranil Ganguly Indranil Ganguly - 1 year ago 57
Bash Question

Cron job with shell script

i am trying to run a shell script using cronjob after every 2 minutes. I opened my terminal then typed


once i execute this command i am writing my command

*/2 * * * * /home/test/test/

but i am getting an error as

E486: Pattern not found: 2 * * * *

please help as i am new to this and i don't know why it is happening.
If you give me any links and code on hwo to execute cronjob it would help.

Answer Source

As mentioned in comments, the following error:

E486: Pattern not found: 2 * * * *

Was caused because you were not editing properly. That is, you were saying crontab -e correctly and then you were entering in vi. Instead of going into the insert mode, you would directly type */2 * * * * /home/test/test/, which vi would try to perform as a command, which is not.

So what you have to do is to press i to enter in the write mode. And then, just then, write */2 * * * * /home/test/test/ Finally, save the file by saying :wq.

In case other problems occur in your cronjob, you may want to check the "Debugging crontab" section in