想在mac下弄一个crontab定时任务,以为会像linux上那样顺利那,结果碰壁了,报错信息如下:
? autoshell crontab -e
crontab: no crontab for laijingli - using an empty one
crontab: temp file must be edited in place
就是这个 must be edited in place提示也太模糊了了吧,网上有说是编辑器环境变量的问题,加上也不行呀
? autoshell EDITOR=vim crontab -e
crontab: no crontab for laijingli - using an empty one
crontab: temp file must be edited in place
? autoshell EDITOR=vi crontab -e
crontab: no crontab for laijingli - using an empty one
crontab: temp file must be edited in place
参考了一外国哥们的方法,vim设置对文件类型为crontab的文件不进行backup、writebackup,虽不很明白,但起作用了,期待高手指点迷津。
? ~ vim ~/.vimrc 添加如下2行
21 "解决crontab -e时,提示crontab: temp file must be edited in place
22 autocmd filetype crontab setlocal nobackup nowritebackup
? ~ crontab -l
1 * * * * /Users/laijingli/autoshell/fastproxy >>/tmp/fastproxy.log
Reference:http://calebthompson.io/crontab-and-vim-sitting-in-a-tree/