How can I change the cron?

Posted on

Problem :

I have a script that I want to be run every X minutes. I already have the cron sentence I need to paste to the cron, but can’t find it anywhere.

The terminal command ‘crontab -e’ works, but it opens it in vim! No way I’m using that yet. How can I edit this file using gedit?

I don’t even know the path to the file.

Here’s the script:

*/3 * * * * /home/sergio/myscript.sh

How can I use gedit to manually add this line? Thanks!

Solution :

You shouldn’t edit the crontab file directly anyway, so you don’t need to know the path to it. That said, you should be able to find the location on your system from man cron.

If you would rather use gedit than vim as your default editor, then add this to your ~/.profile:

EDITOR=gedit

In the short term (before logging out and back in), you can do as suggested above, i.e., from the command line:

EDITOR=gedit crontab -e

You can find out the path using:

`which crontab`

But you’d probably better off by setting your default editor. Try:

EDITOR=`which gedit` crontab -e

Leave a Reply

Your email address will not be published. Required fields are marked *