为什么在使用 vim 时 OS X 上没有 crontab 条目? [英] Why I've got no crontab entry on OS X when using vim?

查看:17
本文介绍了为什么在使用 vim 时 OS X 上没有 crontab 条目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的 Mac 上使用 cron.我选择它而不是 launchd,因为我也希望能够在 Linux 上使用我的新知识.但是,我似乎无法使 crontab -e 命令起作用.它启动了 vim,我进入了我的测试工作:

I would like to use cron on my Mac. I choose it over launchd, because I want to be able to use my new knowledge on Linux as well. However, I cannot seem to get the crontab -e command to work. It fires up vim, I enter my test job:

0-59 * * * * mollerhoj3 echo "Hello World"

但是保存退出后(:wq),

crontab -l

说:

No crontab for mollerhoj3

我做错了什么?

推荐答案

只需按照以下步骤操作:

Just follow these steps:

  1. 在终端中:crontab -e.
  2. i 进入 vim 的插入模式.
  3. 输入您的 cron 作业,例如:

  1. In Terminal: crontab -e.
  2. Press i to go into vim's insert mode.
  3. Type your cron job, for example:

30 * * * * /usr/bin/curl --silent --compressed http://example.com/crawlink.php

  • Esc 退出 vim 的插入模式.

  • Press Esc to exit vim's insert mode.

    但是请注意,根据您的 ~/.vimrc 文件的内容,这可能不起作用.

    Note however that this might not work depending on the content of your ~/.vimrc file.

    这篇关于为什么在使用 vim 时 OS X 上没有 crontab 条目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆