Welcome to WebmasterWorld Guest from

Forum Moderators: bakedjake

Message Too Old, No Replies

Edit crontab.vim file

How do i run program through crontab.vim file



7:04 pm on Sep 27, 2007 (gmt 0)

5+ Year Member

Hi All,

I am having a problem to run a program through crontab.vim file which is located in this directory:/usr/share/vim/vim71/syntax/crontab.vim. When i run a shell script program by putting my file . It does not run.

Any help will be appreciated..



8:04 pm on Sep 27, 2007 (gmt 0)

WebmasterWorld Senior Member jtara is a WebmasterWorld Top Contributor of All Time 10+ Year Member

I'm not sure what you are asking.

crontab.vim isn't used to "run a program". It's a file which comes with the vim editor. It tells vim how to parse crontab files, so that it can display them with neat colors.

There's probably nothing that you should be doing with crontab.vim, except leaving it alone.


10:43 pm on Sep 27, 2007 (gmt 0)

WebmasterWorld Senior Member wheel is a WebmasterWorld Top Contributor of All Time 10+ Year Member

On my system, if you enter:
crontab -l
it lists all the cron jobs. To add a new cron job or edit the existing ones I would enter this:
crontab -e
Which will open an editor. You don't put the programs themselves in there, just the one line per script that points at the script and tells it when to run. So I would see a file like this:
0 3 * * * /path/to/my/script
which would run that script at 3 in the morning every night. Of course I have to make sure that executing
actually works directly from the command line.

In other words, you edit the crontab using the crontab -e command, but that's just the list of individual programs to run using cron. And don't edit it using vim, use crontab -e.



4:27 pm on Sep 28, 2007 (gmt 0)

5+ Year Member

Can you please tell me how can I run cron jobs using vim editor? I am using cygwin and vim editor.



5:40 pm on Sep 30, 2007 (gmt 0)

WebmasterWorld Senior Member wheel is a WebmasterWorld Top Contributor of All Time 10+ Year Member

You don't 'run cron jobs through vim'.

First you create a script. That script could be writtin in PHP, or Java, or a shell script, or in whatever. You can run this script from the command line. THis step has nothing to do with vim or cron. You just need a program of some type that already can be run on your server.

You then use a command like 'crontab -e' which will launch vim to edit the crontab file. You edit this file to tell it what time and dates to run the above script.

You don't use crontab to create or edit scripts. You only use cron to run scripts that already exists, at specific times.


5:16 pm on Nov 4, 2007 (gmt 0)

10+ Year Member


Your question is a little confusing, but what you MAY be looking for is that your need to make sure your EDITOR environment variable is set to the editor you want to use while editing your crontab file. The exact syntax varies with what shell you are using, but one of the following two will likely work:

(sh style) Bash, ksh:
EDITOR=vim ; export EDITOR

(csh style):
setenv EDITOR vim

That is assuming that the command you type to use vim is in fact 'vim'. If it's actually vi, then set it to 'vi' instead.

After that, typing crontab -e will use vim to edit your crontab. To make the change in your EDITOR environment variable permanent, you'll need to change your startup .profile or .cshrc to include the command.


Featured Threads

Hot Threads This Week

Hot Threads This Month