Welcome to WebmasterWorld Guest from 220.127.116.11
Forum Moderators: bakedjake
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..
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.
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.
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.
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
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.