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.
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 /path/to/my/script 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.
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.
Msg#: 3463034 posted 5:16 pm on Nov 4, 2007 (gmt 0)
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.