Linux Crontab定时任务

来源:互联网 发布:核与辐射安全中心 知乎 编辑:程序博客网 时间:2024/06/05 03:23

Linux Crontab定时任务

crontab -e报错:

Error detected while processing /home/work/.vimrc:line   20:E518: Unknown option: cursorlineline   58:E107: Missing braces: vundle#rc()line   59:E492: Not an editor command: Bundle 'Lokaltog/vim-powerline'line   60:E492: Not an editor command: Bundle 'tomtom/tlib_vim'line   61:E492: Not an editor command: Bundle 'flazz/vim-colorschemes'line   62:E492: Not an editor command: Bundle 'MarcWeber/vim-addon-mw-utils'line   63:E492: Not an editor command: Bundle 'garbas/vim-snipmate'line   64:E492: Not an editor command: Bundle 'kien/ctrlp.vim'line   65:E492: Not an editor command: Bundle 'Lokaltog/vim-easymotion'line   67:E492: Not an editor command: Bundle 'tpope/vim-surround'line   68:E492: Not an editor command: Bundle 'tristen/vim-sparkup'line   69:E492: Not an editor command: Bundle 'scrooloose/nerdtree'line   70:E492: Not an editor command: Bundle 'vim-scripts/Colour-Sampler-Pack'line   71:E492: Not an editor command: Bundle 'pangloss/vim-javascript'line   73:E492: Not an editor command: Bundle 'L9'line   74:E492: Not an editor command: Bundle 'FuzzyFinder'line   75:E492: Not an editor command: Bundle 'taglist.vim'line   78:E492: Not an editor command: Bundle 'git://git.wincent.com/command-t.git'Hit ENTER or type command to continuecrontab: no changes made to crontab

单独使用vim编辑文件时并没有如此错误提示。

解决方案

由于单独使用vim时并没有如此错误,怀疑默认的编辑器并非vim,利用echo $EDITOR查看默认的编辑器结果为空,因此设置默认的编辑器为vim.

编辑~/.bashrc,在末尾添加export EDITOR=vim,然后执行source ~/.bashrc,然后在运行以上的如crontab -e 或者less命令错误提示没有出现,问题解决。

备注

如果单独使用vim就出现以上错误提示,可能原因没有安装Vundle插件管理,可以通过git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim安装。如果已经安装Vundle插件管理,仍然出现以上错误提示,可能是没有运行相关命令安装对应插件导致,可以通过在vim中运行:BundleInstall来解决该问题。

原创粉丝点击